def m = [:] //定义空map def m = [a:6,b:20,c:1,d:22] def sorted = m.sort { a, b -> b.value <=> a.value } //降序排列 def sorted = m.sort { a, b -> a.value <=> b.value } //升序排列 println sorted
def m = [:] //定义空map def m = [a:6,b:20,c:1,d:22] def sorted = m.sort { a, b -> b.value <=> a.value } //降序排列 def sorted = m.sort { a, b -> a.value <=> b.value } //升序排列 println sorted