实例
List<BlogComment> blogCommentListResult = new ArrayList<>(blogCommentMap.values());
Map数据转换为自定义对象的List,例如把map的key,value分别对应Person对象两个属性:
List<Person> list = map.entrySet().stream().sorted(paring(e -> e.getKey())).map(e -> new Person(e.getKey(), e.getValue())).collect(Collectors.toList());List<Person> list = map.entrySet().stream().sorted(paring(Map.Entry::getValue)).map(e -> new Person(e.getKey(), e.getValue())).collect(Collectors.toList());List<Person> list = map.entrySet().stream().sorted(paringByKey()).map(e -> new Person(e.getKey(), e.getValue())).collect(Collectors.toList());
以上三种方式不同之处在于排序的处理