标签:cti ring compare ret reg href get arrays blank
//这里的顺序,是我自己定义的一个List<String> String[] regulation = {"诸葛亮","鲁班","貂蝉","吕布"}; final List<String> regulationOrder = Arrays.asList(regulation); String[] ordered = {"貂蝉","诸葛亮","吕布","貂蝉","鲁班","诸葛亮","貂蝉","鲁班","诸葛亮"}; List<String> orderedList = Arrays.asList(ordered); Collections.sort(orderedList, new Comparator<String>() { public int compare(String o1, String o2) { int io1 = regulationOrder.indexOf(o1); int io2 = regulationOrder.indexOf(o2); return io1 - io2; } }); System.out.println(orderedList);
原 :http://blog.csdn.net/u012854870/article/details/78052159
Collections自定义List排序规则,进行自定义排序
标签:cti ring compare ret reg href get arrays blank
原文地址:https://www.cnblogs.com/yoci/p/9446514.html