java8的List.sort()排序功能

//按照List中对象的fileKind属性排序
PathInfos.sort(Comparator.comparing(PathInfo::getFilekind));
//按照List中对象的fileKind属性倒转排序 ,添加reversed()方法
PathInfos.sort(Comparator.comparing(PathInfo::getFilekind).reversed());

猜你喜欢

转载自blog.csdn.net/sayoko06/article/details/88290421