Does Google App Engine support TreeSet
? If so, assuming there are no duplicates and the elements are Comparable
, use a TreeSet
.
List list = your ArrayList
List sortedList = new ArrayList(new TreeSet(list));
You can also supply a Comparator
to TreeSet
if the elements aren't Comparable
. I left generics left out for simplicity.