List<MercRateEntity> rateList = new ArrayList();
1、根据list对象中某个字段去重
List<MercRateEntity> rateList = rateEntityList.stream().collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MercRateEntity::getItemCode))), ArrayList::new))
2、将list取对象某个字段作为key,对象作为value转为map
Map<String,MercRateEntity> rateMap = rateEntityList.stream().collect(Collectors.toMap(e -> e.getItemCode(), Function.identity()));
3、将list按照对象某个字段排序
List<MercRateEntity> sortList = rateList .stream().sorted(Comparator.comparing(MercRateEntity::getItemCode)).collect(Collectors.toList());
4、将list遍历处理之后重新组成list
List<String> newList = rateList .stream().map(e->e.getItemCode).collect(Collectors.toList());