1.对于数组的排序方法如下:
String[] names = {"王林", "杨宝", "李镇", "刘迪", "刘波"}; Arrays.sort(names, com.ibm.icu.text.Collator.getInstance(com.ibm.icu.util.ULocale.SIMPLIFIED_CHINESE));//升序; System.out.println(Arrays.toString(names));
2.对于汉字的排序:可以尝试使用ICU4J会得到更好的结果,特别是姓为某些生僻字的时候,
用com.ibm.icu.text.Collator替换java.text.Collator,用com.ibm.icu.util.ULocale替换java.util.Locale
3.对于枚举类型的enum1.compareTo(enum2)是按照枚举类型值在定义时的先后顺序比较的,越后面的越大,而不是按照值的字母先后顺序比较的。
public class Test {
public static void main(String[] args) {
List >totallist = new ArrayList>();
Map map = new HashMap();
map.put("PaymentType", PayType.S);
Map map1 = new HashMap();
map1.put("PaymentType", PayType.E);
Map map2 = new HashMap();
map2.put("PaymentT