The TO SET aggregation function aggregates an input stream to a Set.
Set
For example, you can aggregate a stream of persons to a Set<String> retrieving their ages.
Set<String>
person.age