java8的List.sort()排序功能

//按照List中对象的fileKind属性排序

PathInfoList.sort(Comparator.comparing(PathInfo::getFilekind));

//按照List中对象的fileKind属性倒转排序 ,添加reversed()方法

PathInfoList.sort(Comparator.comparing(PathInfo::getFilekind).reversed());

原文链接:https://blog.csdn.net/sayoko06/article/details/88290421

你可能感兴趣的:(java8的List.sort()排序功能)