I have the following Groovy code :
def number = "246" as List
def number1= number.subsequences()
//outputs: [[6], [2, 6], [4, 6], [2], [2, 4, 6], [4], [2, 4]]
Now what i want is, each list in number1 should be returned as int, say for example the second list in number1 should be returned as 26. What i have did was :
number1.each{ it }.collect() as int
Which is not working and throwing an error. Can this be done in any other ways?
Thanks in advance and correct me if am wrong
You need:
That will
join()each of the numbers in the sub-lists into aString, then convert thatStringto anint