How do I reverse the order of the data in a TreeSet instance?
问题 I have a class called Dictionary which is a collection of sorted strings. This class is an extension of the TreeSet class, which means that it uses a Comparator for the sorting. I want to have a reverse method for reversing the order of the data set, but this is unfortunately not possible since TreeSet can't change it's Comparator after initialization. As a workaround I tried to create a new Dictionary instance using a reversed version of the original Comparator, but I can't come up with any