Skip to content

Commit e3efcdc

Browse files
committed
Update
1 parent b0f0a3d commit e3efcdc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

driver/src/main/java/org/neo4j/driver/querytask/QueryTask.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
* }
6868
* }
6969
* </pre>
70-
* <p>
7170
* In addition, it is possible to transform query result by using a supplied {@link Collector} implementation.
7271
* <p>
7372
* <b>It is strongly recommended to use Cypher query language capabilities where possible</b>. The examples below just
@@ -78,12 +77,25 @@
7877
*
7978
* var averagingLong = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
8079
* .execute(averagingLong(record -> record.get("N").asLong()));
80+
*
8181
* var filteredValues = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
8282
* .execute(mapping(record -> record.get("N").asLong(), filtering(value -> value > 2, toList())));
83+
*
8384
* var maxValue = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
8485
* .execute(mapping(record -> record.get("N").asLong(), maxBy(Long::compare)));
8586
* }
8687
* </pre>
88+
* If there is a need to access {@link ResultSummary} value, another method option is available:
89+
* <pre>
90+
* {@code
91+
* import static java.util.stream.Collectors.*;
92+
*
93+
* private record ResultValue(Set<Long> values, ResultSummary summary) {}
94+
*
95+
* var result = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
96+
* .execute(Collectors.mapping(record -> record.get("N").asLong(), toSet()), ResultValue::new);
97+
* }
98+
* </pre>
8799
*
88100
* @since 5.5
89101
*/

0 commit comments

Comments
 (0)