首页 > 解决方案 > 如何在 Grovy 中对地图列表进行排序

问题描述

我是 groovy 的新手。这是我的代码。我有一个常规地图列表,例如:

list = [[query:"insert into table", order:5],
        [query:"insert into table", order:1],
        [query:"insert into table", order:2]]

我正在尝试如下

list.sort({ob1,ob2 -> ob1.order <=> ob2.order})

我想按顺序排序。

标签: groovy

解决方案


推荐阅读