Iterators { public static <T> Flux<T> toFlux(Iterator<T> iterator) { return Flux.fromStream(toStream(iterator)); }  static Stream<T> toStream(Iterator<T> iterator); static Flux<T> toFlux(Iterator<T> iterator);  }
@Test void toFluxShouldReturnEmptyStreamWhenEmptyIterator() { UnmodifiableIterator<String> emptyIterator = ImmutableList.<String>of().iterator(); Flux<String> actual = Iterators.toFlux(emptyIterator); assertThat(actual.count().block()).isEqualTo(0); }
@Test void toFluxShouldReturnSameContent() { UnmodifiableIterator<String> iterator = ImmutableList.of("a", "b", "c").iterator(); Flux<String> actual = Iterators.toFlux(iterator); assertThat(actual.collect(toList()).block()).containsExactly("a", "b", "c"); }