If I have an ArrayList of custom objects which I need to be able to display them in various sortings (e.g. 4 types of sort so 4 comparators to use the proper member variables of the objects for the sorting) what is the most efficient way to do it?
I don’t think having e.g. 4 array lists of the objects sorted according to a specific comparator is optimal.
Is there another more efficient way than this?
Please note that I would need to have these objects sorted at the same time as they will be presented in the same page. So I can’t sort on demand
Aucun commentaire:
Enregistrer un commentaire