@Test public void testStream() { withSession(session -> { MappedQueryResult<String> resultSet = new MappedQueryResult<>(session.execute("select id, value from test"), row -> row.getString(1)); Set<String> strings = resultSet.stream().map(String::toUpperCase).collect(Collectors.toSet()); assertEquals(3, strings.size()); assertTrue(strings.contains("ONE")); assertTrue(strings.contains("TWO")); assertTrue(strings.contains("THREE")); }); }
@Override public Stream<T> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE), false); }
MappedQueryResult implements QueryResult<T> { @Override public Stream<T> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE), false); } }
MappedQueryResult implements QueryResult<T> { @Override public Stream<T> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE), false); } MappedQueryResult(Iterable<Row> rows, RowMapper<T> mapper);  MappedQueryResult(ResultSet resultSet, RowMapper<T> mapper); }
MappedQueryResult implements QueryResult<T> { @Override public Stream<T> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE), false); } MappedQueryResult(Iterable<Row> rows, RowMapper<T> mapper);  MappedQueryResult(ResultSet resultSet, RowMapper<T> mapper); @Override Iterator<T> iterator(); @Override List<T> list(); @Override T one(); @Override Stream<T> stream(); }
MappedQueryResult implements QueryResult<T> { @Override public Stream<T> stream() { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.IMMUTABLE), false); } MappedQueryResult(Iterable<Row> rows, RowMapper<T> mapper);  MappedQueryResult(ResultSet resultSet, RowMapper<T> mapper); @Override Iterator<T> iterator(); @Override List<T> list(); @Override T one(); @Override Stream<T> stream();  }