dcsimg

In a TreeMap, can I use a sorting algorithm other than the natural sorting for the keys?

John Zukowski

You can pass a Comparator to the TreeMap constructor to use a sorting order other than the natural order.