📜  hashmap 升序排序 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:06.594000             🧑  作者: Mango

代码示例1
LinkedHashMap sortedMap = new LinkedHashMap<>();
 
unSortedMap.entrySet()
    .stream()
    .sorted(Map.Entry.comparingByKey())
    .forEachOrdered(x -> sortedMap.put(x.getKey(), x.getValue()));