!205 StreamUtils优化分组方法返回由HashMap无序转为LinkedHashMap有序

Merge pull request !205 from 抓蛙师/auto-7465549-dev-1657957318499
This commit is contained in:
疯狂的狮子Li 2022-07-16 07:44:26 +00:00 committed by Gitee
commit a2843b599d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -125,7 +125,7 @@ public class StreamUtils {
} }
return collection return collection
.stream() .stream()
.collect(Collectors.groupingBy(key, Collectors.toList())); .collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList()));
} }
/** /**
@ -146,7 +146,7 @@ public class StreamUtils {
} }
return collection return collection
.stream() .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 return collection
.stream() .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)));
} }
/** /**