How Do I collect in java 8 to a set by some field? for example: I have 2 object with different hashes (that's why they are two entities in the set) but I want to have a set with only one instance of it
tried this: but it gives me two students while I have only 1 unique.
Set<Man> students =
people.stream().collect( Collectors.mapping( Man::isStudent, Collectors.toSet()));
name:"abc" , id:5 (hash 1XX)
name:"abc", id:5 (has 5XX)
and I want the set to contain only one instance
Thanks