@[toc]
一、介绍
该代码使用 Java 8 Stream 的 sorted() 方法和 Comparator.comparing() 对 Repeater 对象列表按照 siteId 字段进行升序排序,并收集为新的 List 集合。
二、代码
List<Repeater> repeaterList = rptList.stream().sorted(Comparator.comparing(Repeater::getSiteId)).collect(Collectors.toList());
重要信息