v1.0.0
文章目录
去重
list object
depts = depts.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SysDept::getDeptId))), ArrayList::new));
分页
小数据
firstLevelList = firstLevelList.stream().skip(limit * (page - 1)).limit(limit).collect(Collectors.toList());
本文介绍了如何在Java中进行列表对象的去重,利用TreeSet的特性保证元素唯一性,然后转换回ArrayList。同时,展示了对于小数据量的分页处理,通过skip和limit方法实现简单的分页功能。
6488

被折叠的 条评论
为什么被折叠?



