friends, I am new to Java-Collection. I want to ask does Collections.sort() method only used for/by collections which are List type. I was unable t
Collections.sort()
List
sort(List list) of Collections is the original method which expects of type List. But To sort Set basically we use TreeSet, which sorts elements by the help of compare() or compareTo() methods of Comparator and Comparable interfaces respectively.
sort(List list)
compare()
compareTo()