java8 lambda groupingby 分组保持原来顺序

returnRemindList.stream().collect(Collectors.groupingBy(TopicRemindSettingBO::getRemindPhone, LinkedHashMap::new, Collectors.toCollection(ArrayList::new)));
returnRemindList 是已经排序好序的集合,groupingBy 分组后map是不保持有序, 加入如下2个参数可以保持原来的顺序输出
LinkedHashMap::new, Collectors.toCollection(ArrayList::new))
posted @ 2017-09-20 15:48  蝼蚁尚不自知  阅读(2673)  评论(0编辑  收藏  举报