arrays对中文排序

public static void main(String[] args) {
fanhuiImpl aFanhuiImpl = new fanhuiImpl();
aFanhuiImpl.ok("dd");

String [] city={"泰安市","山东安市","山东省泰安市","山东省济南市","山东省泰安市","山东省青岛市","山东省泰安市","山东省肥城市",
"山东省济南市","山东省济南市","山东省泰安市"};

Arrays.sort(city,new Comparator<String>() {
public int compare(String o1, String o2) { 
       return Collator.getInstance(Locale.CHINESE).compare(o1, o2); 
   } 
});
for (int i = 0; i < city.length; i++) {
System.out.println(city[i]);
}
}

你可能感兴趣的:(String,Arrays)