I've got a program that has a bunch of data objects. Each of these implement Comparable, and are set up to sort from highest to lowest (based on a simple long value) including duplicates values. I want these objects to be stored in a set/list such that I can iterate over it, and pull out each object in its respective place.
I've looked at using a TreeSet, however this does not allow duplicates, and so only keeps one of the many objects with the same values. I then found TreeMultiset, which could keep elements with the same value. The only problem with that is that it simply stores duplicates of the same object, rather than multiple objects that are equal.
Is there a library/built in object that I can use that will do what I want, or should I create an implementation myself?
Note: the reason I don't want the object duplicating in TreeMultiset is because the object contains a unique ID to a user, and a time value (this is what is compared)