Possible Duplicate:
Sorting a collection of objects
Sorting an ArrayList of Contacts based on name?
A quick question for you:
I’ve got an ArrayList<MyObject> filled with MyObject objects. I would like them to be sorted based on an integer variable of MyObject.
Is there a ready way to implement this or will I have to write a quicksort/mergesort myself?
Thank you for your time,
Dimitris
You can also use the
Collections.sort()libraries and pass in your collections (ArrayList) and a specifically designedComperatorfor your objects.