I am multiple ArrayLists with custom objects that implement the Comparatorinterface. Its possible that these multiple lists have the same objects. My requirement is each list can have its own order
For eg:
list 1 can contain 4 objects Obj2, Obj4, Obj1, Obj3 list 2 can contain say 5 objects Obj4, Obj3 , Obj5 , Obj1 , Obj2
If I assign an id of (0,1,2,3,4) in List1 to each custom object and use the sort method on the ArrayList I think it will work for me if I have a single List.
But I cannot do that because the same objects will need to be in different order for List2. Is there a way I can use the comparator and depend on the Collections framework sorting for me instead of me having to maintain a separate order list for each ArrayList ?
Any help will be greatly appreciated.
Thanks