java8-stream-filter 数组去重
- 目标:
- 方法:
目标:
对目标数组去重,并筛选出要用的数组
方法:
//数组去重
idList.stream().distinct();
//数组筛选
list.stream().filter(coo->idList.contains(coo.get("cooperationId").toString()));
相当于:
//数组去重
idList.stream().distinct();
list=list.stream().filter((Map<String, String> coo)->(idList.contains(coo.get("cooperationId").toString()))).collect(Collectors.toList());