I have two User
List
objects, merged:
objectList1.addAll(objectList2);
To avoid duplicates converted to a HashSet
:
Set<User> users = newHashSet(objectList);
How can I sort the users in ascending order based on First Name?
I tried to use TreeSet
, in place of HashSet
but that throws Exception
.
How can I achieve the result without making the User
class to implement
Comparable<User>
?