first

Note that unlike in (Oracle) SQL, where the FIRST function
is an ordered set aggregate function that produces a set of results, this
collector just produces the first value in the order of stream traversal.
For matching behaviour to Oracle's [ aggregate function ] KEEP
(DENSE_RANK FIRST ORDER BY ... ), use maxAll(Comparator) instead.

last

Note that unlike in (Oracle) SQL, where the FIRST function
is an ordered set aggregate function that produces a set of results, this
collector just produces the first value in the order of stream traversal.
For matching behaviour to Oracle's [ aggregate function ] KEEP
(DENSE_RANK LAST ORDER BY ... ), use minAll(Comparator) instead.