@Test public void asStreamShouldConvertIteratorToStream() { List<String> elems = Arrays.asList("elem 1", "elem 2", "elem 3"); Stream<String> elemStream = StreamUtils.asStream(elems.iterator()); assertThat(elemStream.collect(Collectors.toList()), is(elems)); }
public static <X> Stream<X> asStream(Iterator<X> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); }
StreamUtils { public static <X> Stream<X> asStream(Iterator<X> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } }
StreamUtils { public static <X> Stream<X> asStream(Iterator<X> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } private  StreamUtils(); }
StreamUtils { public static <X> Stream<X> asStream(Iterator<X> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } private  StreamUtils(); static Stream<X> asStream(Iterator<X> iterator); static R withCloseableIterator(CloseableIterator<X> iterator, Function<Stream<X>, R> f); }
StreamUtils { public static <X> Stream<X> asStream(Iterator<X> iterator) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false); } private  StreamUtils(); static Stream<X> asStream(Iterator<X> iterator); static R withCloseableIterator(CloseableIterator<X> iterator, Function<Stream<X>, R> f);  }