我需要对 ArrayList 进行排序,但我不能使用 Collections.sort(),因为 Google App Engine 的 Java 运行时环境不支持它。我能怎么做?谢谢! ^^
最佳答案
如果您的 ArrayList 没有重复值......我假设即使它有,您也不想拥有冗余数据..所以最好一起使用 TreeSet 和 Comparator...
例如:
ArrayList<MyObject> arr = new ArrayList<MyObject>();
TreeSet<MyObject> t = new TreeSet<MyObject>(Comparator c);
t.addAll(arr);
关于Java - Google App Engine - 不使用 Collections.sort() 对 ArrayList<Object> 进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11377612/