直接上代码:
private static void demo1() {
ArrayList<String> dataOne = new ArrayList<>();
dataOne.add("张三");
dataOne.add("张啊");
dataOne.add("张的");
dataOne.add("张吧");
Comparator<Object> CHINA_COMPARATOR = Collator.getInstance(Locale.CHINA);
Collections.sort(dataOne, CHINA_COMPARATOR);
System.out.println(dataOne);
}
输出:
image.png
网友评论