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))
原文地址:https://www.cnblogs.com/xlh91118/p/7561957.html