I know that The Treeset Sort the input automatically but don’t accept duplicates.Is there any class Collection in java that allows Duplicate values or objects and Sort the given Input
I know that The Treeset Sort the input automatically but don’t accept duplicates.Is there
Share
User List Implementation and sort them using
Collection.sort()But if you are using you object in collection then Implement
Comparableinterface and overridecompare(Object obj,Object obj1)method.Otherwise you can write your
Comparatorthen pass it tosortmethod.