//简洁判断是否包含 private Set<Long> existList; Long ceshi = 111; 判断是否包含在list里面 boolean existInsertPolicyId = CollUtil.contains(existList, ceshi);
stream 流list转换为map<string,对象>
List<user> list = new ArrayList<>();
Map<String, user> map = list.stream().collect(Collectors.toMap(user::getId, Function.identity(), (e1, e2) -> e1))
stream 流list转换过来单个字段List<string> 或Set<String>
List<user> list = new ArrayList<>();
List<String> ids = list.stream().map(x -> x.getId()).collect(Collectors.toList());
Set<String> setIds = list.stream().map(user::getId()).collect(Collectors.toSet());
stream 流list转换Map<String,List<user>>
Map<String,List<user>> passMap = list.stream().collect(Collectors.groupingBy(a-> a.getId()));
stream 流过滤某个条件list
List<user> passList = List.stream().filter(o->o.getState().equals("1")).collect(Collectors.toList());