From 55ba098e506df00e982581eeb4c074a344d60177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8A=93=E8=9B=99=E5=B8=88?= <770492966@qq.com> Date: Sat, 16 Jul 2022 15:41:51 +0800 Subject: [PATCH] =?UTF-8?q?StreamUtils=E4=BC=98=E5=8C=96=E5=88=86=E7=BB=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E=E7=94=B1HashMap=E6=97=A0?= =?UTF-8?q?=E5=BA=8F=E8=BD=AC=E4=B8=BALinkedHashMap=E6=9C=89=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/StreamUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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..fccd9e3d1 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 @@ -125,7 +125,7 @@ public class StreamUtils { } return collection .stream() - .collect(Collectors.groupingBy(key, Collectors.toList())); + .collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList())); } /** @@ -146,7 +146,7 @@ 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 +167,7 @@ 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))); } /**