1. 程式人生 > >集合按照拼音首字母排序

集合按照拼音首字母排序

public void sortListByInitialWordPinyin(List<SysGroup> departmentList) {
        Collections.sort(departmentList,new Comparator<SysGroup>() {
            @Override
            public int compare(SysGroup sysGroup1, SysGroup sysGroup2) {
                Comparator<Object> com = Collator.getInstance(Locale.CHINA);
                return com.compare(sysGroup1.getGroupName(), sysGroup2.getGroupName());
            }
        });
    }