I have a class with the following variables (entities):
Identifier
Entry_Number
Rest_of_the_data
I'd like to sort the instances of this class as follows:
Sort the instances by the Identifier
variable, then for instances with the same Identifier
values, sort them by the Entry_Number
variable.
I know I can implement Comparable with one of these entities as the key, but I don't know how to go about this to sort sequentially on two entities.
That is, after sorting by the Identifier
when I sort by the Entry_Number
, the initial sorting should not be disturbed - the second sorting should apply only to those instances with the same Identifier
values.
So, in effect, I want to be able to pass as "second key" item to resolve ties.