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]