for example, using the following:

the collection Set and sorting as we go.
Code:
Set sortedObject= new TreeSet<SomeObject>(comparator);
or

the collection list and sorting when all elements are in the list.
Code:
Collections.sort(list, comparator);
what are the adv and disadv in terms of memory usage and execution time?