groovy同时迭代多个List

1
2
3
4
5
6
7
def list1 = [1, 2, 3]  
def list2 = [4, 5, 6
def result = true 
list1.eachWithIndex { n, i ->  
    if (n >= list2[i]) result = false 
}  
assert result

编程技巧