【发布时间】:2021-05-12 19:08:16
【问题描述】:
我有一个像这样的TreeMap:
{
"one": "First option",
"two": "Second option",
"three": "Third option",
"four": "Last option"
}
我想使用这个对象,以便输出如下:
{
"four": "First option",
"three": "Second option",
"two": "Third option",
"one": "Last option"
}
我正在查看一些来自 apache 的公共集合实用程序,但没有立即看到任何可以解决问题的方法。
没有一堆循环的最简洁的方法是什么?
【问题讨论】:
标签: java sorting dictionary hashmap treemap