I need to sort an ArrayList and i can't use Collections.sort(), because Google App Engine's Java runtime environment doesn't support it. How can I do? Thanks! ^^
If your ArrayList has NO DUPLICATE VALUES..... and i am assuming even if it had, you didnt wanted to have redundant data..so its better to use TreeSet and Comparator together...
Eg:
ArrayList<MyObject> arr = new ArrayList<MyObject>();
TreeSet<MyObject> t = new TreeSet<MyObject>(Comparator c);
t.addAll(arr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With