diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StreamUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StreamUtils.java index 0de2784a0..99d58979f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StreamUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StreamUtils.java @@ -124,8 +124,8 @@ public class StreamUtils { return MapUtil.newHashMap(); } return collection - .stream() - .collect(Collectors.groupingBy(key, Collectors.toList())); + .stream() + .collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList())); } /** @@ -146,7 +146,8 @@ public class StreamUtils { } return collection .stream() - .collect(Collectors.groupingBy(key1, Collectors.groupingBy(key2, Collectors.toList()))); + .collect(Collectors.groupingBy(key1, LinkedHashMap::new, + Collectors.groupingBy(key2, LinkedHashMap::new, Collectors.toList()))); } /** @@ -167,7 +168,8 @@ public class StreamUtils { } return collection .stream() - .collect(Collectors.groupingBy(key1, Collectors.toMap(key2, Function.identity(), (l, r) -> l))); + .collect(Collectors.groupingBy(key1, LinkedHashMap::new, + Collectors.toMap(key2, Function.identity(), (l, r) -> l))); } /**