There is nothing with the realities that do this. You will need to track this yourself. You can subclass the implementation of Collection to add fields containing this information.
You can also map implementations to metadata of your choice using a map - in particular, it seems that you want IdentityHashMap to do this because you do not want to compare two different collections for equality as keys with equal () keys.
I would keep the boolean (up / down) and Comparator link used for sorting, if that is what defines the sort completely. Or, if it is sorted by field, save the line that called the field, perhaps.
source share