Forum Discussion
akashreuben7
New Contributor
Awesome this helps himanshu.
I have found another way to do it in a simple format.
def Z = ['a','b','c','d','e']
def result =[Z,Z,Z].combinations().findAll{x,y,z -> x<y&y<z}
def result2 = [Z,Z].combinations().findAll{x,y -> x<y}
def finalresult = result + result2
log.info finalresult
result :[[a, b, c], [a, b, d], [a, c, d], [b, c, d], [a, b, e], [a, c, e], [b, c, e], [a, d, e], [b, d, e], [c, d, e], [a, b], [a, c], [b, c], [a, d], [b, d], [c, d], [a, e], [b, e], [c, e], [d, e]]
HimanshuTayal
6 years agoCommunity Hero
Related Content
- 4 years ago
- 6 years ago
Recent Discussions
- 15 years ago