ResultSet implements Iterable<Result> { public Stream<Result> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE | Spliterator.SIZED), false); } ResultSet(final ResultQueue resultQueue, final ExecutorService executor,
                     final CompletableFuture<Void> readCompleted, final RequestMessage originalRequestMessage,
                     final Host host); RequestMessage getOriginalRequestMessage(); Host getHost(); CompletableFuture<Map<String,Object>> statusAttributes(); boolean allItemsAvailable(); CompletableFuture<Void> allItemsAvailableAsync(); int getAvailableItemCount(); Result one(); CompletableFuture<List<Result>> some(final int items); CompletableFuture<List<Result>> all(); Stream<Result> stream(); @Override Iterator<Result> iterator();  }
@Test public void shouldStream() throws Exception { final Stream<Result> stream = resultSet.stream(); final AtomicInteger counter = new AtomicInteger(0); addToQueue(100, 1, true, true); stream.forEach(r -> counter.incrementAndGet()); assertEquals(100, counter.get()); }