Groovy sort() list

https://www.w3cschool.cn/groovy/groovy_sort.html

#Groovy sort()方法
返回原始列表的排序副本。


#句法
List sort()


#参数
没有


#返回值
排序列表。


#例子
下面是一个使用这个方法的例子 -
class Example {
   static void main(String[] args) {
      def lst = [13, 12, 15, 14];
      def newlst = lst.sort();
      println(newlst);
   }
}
当我们运行上面的程序,我们将得到以下结果 -
[12, 13, 14, 15]

原文地址:https://www.cnblogs.com/baxianhua/p/12027972.html