If I have a Map like this:
Map
HashMap map;
and I want to obtain a collection of values sorted us
Collections.sort uses mergeSort which has O(nlog n).
Collections.sort
TreeSet has Red-Black tree underlying, basic operations has O(logn). Hence n elements has also O(nlog n).
TreeSet
So both are same big O algorithm.