gpt4 book ai didi

hu.akarnokd.rxjava2.interop.ZeroOneIterator.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:21:21 29 4
gpt4 key购买 nike

本文整理了Java中hu.akarnokd.rxjava2.interop.ZeroOneIterator.<init>()方法的一些代码示例,展示了ZeroOneIterator.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroOneIterator.<init>()方法的具体详情如下:
包路径:hu.akarnokd.rxjava2.interop.ZeroOneIterator
类名称:ZeroOneIterator
方法名:<init>

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());
  }
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com