java对数据按中文名称A~Z进行升序排序
java对数据按中文名称A~Z进行升序排序Collections.sort(listMarketInfo, new Comparator<CementMarketInfoResultsModel>() {
Collator collator = Collator.getInstance(java.util.Locale.CHINA);
public int compare(CementMarketInfoResultsModel arg0, CementMarketInfoResultsModel arg1) {
String name0 = arg0.getCmCfName();
String name1= arg1.getCmCfName();
if(collator.compare(name0,name1)>0)
return 1;
else
return -1;
}
});
页:
[1]