list过滤对象

发布时间 2023-07-19 22:51:30作者: daofree
String local = LocalDate.now().toString().replaceAll("-", "").substring(0, 6);
System.out.println("---------------" + local);
Integer localYearMonth = Integer.valueOf(local);
boolean b = Objects.nonNull(dept4);

List<Dept> collect = strings.stream().filter(Dept -> Objects.nonNull(Dept))
.filter(a -> (Math.abs(Integer.valueOf(a.getAreaId()) - localYearMonth)) <= 200)
.collect(Collectors.toList());
// 按月分表
Map<String, List<MsgReciveEntity>> receiveMonth = collectByTime.stream().collect(Collectors.groupingBy(MsgReciveEntity::getMsgMonth));