update 优化 StreamUtils 分组返回有序 Map 性能不变
parent
a19a59697f
commit
a28f0a28e1
|
|
@ -126,7 +126,7 @@ public class StreamUtils {
|
||||||
}
|
}
|
||||||
return collection
|
return collection
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(key, Collectors.toList()));
|
.collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -147,7 +147,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())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -168,7 +168,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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue