@Test public void testOneWithNoResults() { withSession(session -> { MappedQueryResult<String> resultSet = new MappedQueryResult<>(session.execute("select id, value from test where id = 5"), row -> row.getString(1)); assertNull(resultSet.one()); }); }
@Override public T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; }
MappedQueryResult implements QueryResult<T> { @Override public T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; } }
MappedQueryResult implements QueryResult<T> { @Override public T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; } MappedQueryResult(Iterable<Row> rows, RowMapper<T> mapper);  MappedQueryResult(ResultSet resultSet, RowMapper<T> mapper); }
MappedQueryResult implements QueryResult<T> { @Override public T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; } 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 T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; } 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();  }