本文整理了Java中io.reactivex.Observable.blockingNext()
方法的一些代码示例,展示了Observable.blockingNext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.blockingNext()
方法的具体详情如下:
包路径:io.reactivex.Observable
类名称:Observable
方法名:blockingNext
[英]Returns an Iterable that blocks until this Observable emits another item, then returns that item.
Scheduler: blockingNext does not operate by default on a particular Scheduler.
[中]返回一个Iterable,该Iterable会阻塞,直到该可观察对象发出另一项,然后返回该项。
调度程序:blockingNext默认情况下不会在特定调度程序上运行。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Integer apply(Integer v) throws Exception {
Observable.just(1).delay(10, TimeUnit.SECONDS).blockingNext().iterator().hasNext();
return v;
}
})
代码示例来源:origin: ReactiveX/RxJava
@Test
public void interrupt() {
Iterator<Object> it = Observable.never().blockingNext().iterator();
try {
Thread.currentThread().interrupt();
it.next();
} catch (RuntimeException ex) {
assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = UnsupportedOperationException.class)
public void remove() {
Observable.never().blockingNext().iterator().remove();
}
代码示例来源:origin: ReactiveX/RxJava
@Test /* (timeout = 8000) */
public void testSingleSourceManyIterators() throws InterruptedException {
Observable<Long> o = Observable.interval(250, TimeUnit.MILLISECONDS);
PublishSubject<Integer> terminal = PublishSubject.create();
Observable<Long> source = o.takeUntil(terminal);
Iterable<Long> iter = source.blockingNext();
for (int j = 0; j < 3; j++) {
BlockingObservableNext.NextIterator<Long> it = (BlockingObservableNext.NextIterator<Long>)iter.iterator();
for (long i = 0; i < 10; i++) {
Assert.assertEquals(true, it.hasNext());
Assert.assertEquals(j + "th iteration next", Long.valueOf(i), it.next());
}
terminal.onNext(1);
}
}
代码示例来源:origin: PacktPublishing/Learning-RxJava
@Test
public void testBlockingNext() {
Observable<Long> source =
Observable.interval(1, TimeUnit.MICROSECONDS)
.take(1000);
Iterable<Long> iterable = source.blockingNext();
for (Long i: iterable) {
System.out.println(i);
}
}
}
代码示例来源:origin: PacktPublishing/Learning-RxJava
@Test
public void testBlockingNext() {
Observable<Long> source =
Observable.interval(1, TimeUnit.MICROSECONDS)
.take(1000);
Iterable<Long> iterable = source.blockingNext();
for (Long i: iterable) {
System.out.println(i);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!