本文整理了Java中hu.akarnokd.rxjava2.interop.ZeroOneIterator.<init>()
方法的一些代码示例,展示了ZeroOneIterator.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroOneIterator.<init>()
方法的具体详情如下:
包路径:hu.akarnokd.rxjava2.interop.ZeroOneIterator
类名称:ZeroOneIterator
方法名:<init>
暂无
代码示例来源:origin: akarnokd/RxJava2Jdk8Interop
/**
* Returns a blocking Stream of the single success value of the source Single.
* @param <T> the value type
* @return the new Function to be used with {@code Single.to()}
*/
public static <T> Function<Single<T>, Stream<T>> toStream() {
return s -> {
ZeroOneIterator<T> zoi = new ZeroOneIterator<>();
s.subscribe(zoi);
return ZeroOneIterator.toStream(zoi);
};
}
代码示例来源:origin: akarnokd/RxJava2Jdk8Interop
/**
* Returns a blocking Stream that waits for the Completable's terminal event.
* @param <T> the value type
* @return the Function to be used with {@code Completable.to()}
*/
public static <T> Function<Completable, Stream<T>> toStream() {
return c -> {
ZeroOneIterator<T> zoi = new ZeroOneIterator<>();
c.subscribe(zoi);
return ZeroOneIterator.toStream(zoi);
};
}
代码示例来源:origin: akarnokd/RxJava2Jdk8Interop
/**
* Returns a blocking Stream of a potentially zero or one value (or error) of
* the Maybe.
* @param <T> the value type
* @return the Function to be used with {@code Maybe.to()}
*/
public static <T> Function<Maybe<T>, Stream<T>> toStream() {
return m -> {
ZeroOneIterator<T> zoi = new ZeroOneIterator<>();
m.subscribe(zoi);
return ZeroOneIterator.toStream(zoi);
};
}
代码示例来源:origin: akarnokd/RxJava2Jdk8Interop
@Test
public void zeroOneDirect() {
ZeroOneIterator<Integer> z = Maybe.just(1).subscribeWith(new ZeroOneIterator<>());
Assert.assertEquals(1, z.next().intValue());
try {
z.next();
Assert.fail("Should have thrown");
} catch (NoSuchElementException expected) {
// expected
}
}
代码示例来源:origin: akarnokd/RxJava2Jdk8Interop
@Test
public void zeroOneDirectNever() {
ZeroOneIterator<Integer> z = Maybe.<Integer>never().subscribeWith(new ZeroOneIterator<>());
Assert.assertFalse(z.isDisposed());
z.dispose();
Assert.assertTrue(z.isDisposed());
}
}
内容来源于网络,如有侵权,请联系作者删除!