随笔分类 -  List

摘要:List<User> userList= new ArrayList<>(); List<User> userMergeList= new ArrayList<>(); userList.parallelStream().collect(Collectors.groupingBy(o -> (o.g 阅读全文
posted @ 2023-04-03 09:09 酷盖的小机灵 阅读(369) 评论(0) 推荐(0) 编辑
摘要:Collections.sort(fileRecordDOList, Comparator.comparing(FileRecordDO::getOperateTime).reversed()); reversed()逆序排序,从大到小 若排序的属性值有空值,以上方法会报错,需要使用以下方法升序:从 阅读全文
posted @ 2022-08-03 17:25 酷盖的小机灵 阅读(1365) 评论(0) 推荐(0) 编辑
摘要:1 import java.util.ArrayList; 2 import java.util.List; 3 4 public class CompareTwoListUtil { 5 public static void getList(List<Long> oldGroupIdList, L 阅读全文
posted @ 2022-08-03 17:05 酷盖的小机灵 阅读(468) 评论(0) 推荐(0) 编辑
摘要:用JDK1.8 Stream中对List进行去重: List<String> myList = list.stream().distinct().collect(Collectors.toList()); 阅读全文
posted @ 2022-08-03 17:04 酷盖的小机灵 阅读(99) 评论(0) 推荐(0) 编辑
摘要:1 import com.google.common.collect.Maps; 2 import org.apache.commons.lang3.StringUtils; 3 4 import java.lang.reflect.Method; 5 import java.util.ArrayL 阅读全文
posted @ 2022-08-03 17:04 酷盖的小机灵 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1 Map<Integer, Long> articleSubTypeDisplayNameMap = articleSubTypeList.stream().collect(Collectors.groupingBy(p -> p, Collectors.counting())); 阅读全文
posted @ 2022-08-02 09:21 酷盖的小机灵 阅读(234) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示