我有val myHashMap = HashMap<String, MutableList<TestItem>>()
,hashmap键值的格式日期是字符串,例如20-06-2018
,我如何按降序对此hashMap进行排序?
预期结果:
22-06-2018 : []
21-06-2018 : []
20-06-2018 : []
I use this code to sort it, but result is in ascending order:
val sortedMap = myHashMap.toSortedMap(compareBy { it })