转自:Java8对List进行筛选(Stream)

//对相同内容的list进行去重
List<AppleNode> disList = appleList.stream().distinct().collect(Collectors.toList());


//取出name和code和apleNewList中的数据一致的内容
List<Apple> filterAppleList = appleNewList.stream().filter(apple-> name.equals(apple.getName()).
                                                    filter(apple -> code.equals(apple.getCode())).collect(Collectors.toList());

//根据list中的内容取出最大值对应的实体
Apple filterHs = filterHistoryList.stream().max(Comparator.comparing(Apple:getNumbet).get();