I have a User class with name, type and age and then a long list of these users are my input List<User> users = db.getUsers();.
I am trying to create a set of all unique users from this, but the problem is I am looking for sorting them based on the age also. I have currently used-
Set<User> set = users.stream().collect(Collectors.toSet());
How to sort this set at the same time as well, any idea?