static class ComparatorPinYin implements Comparator<ByOperationBillItem>{
@Override
public int compare(ByOperationBillItem o1, ByOperationBillItem o2) {
return ToPinYinString(o1.getItemName()).compareTo(ToPinYinString(o2.getItemName()));
}
private String ToPinYinString(String str){
StringBuilder sb=new StringBuilder();
String[] arr=null;
for(int i=0;i<str.length();i++){
arr= PinyinHelper.toHanyuPinyinStringArray(str.charAt(i));
if(arr!=null && arr.length>0){
for (String string : arr) {
sb.append(string);
}
}
}
return sb.toString();
}
}