Groovy built-in to split an array into equal sized subarrays?

Posted by Geo on Stack Overflow See other posts from Stack Overflow or by Geo
Published on 2010-05-27T19:51:18Z Indexed on 2010/05/27 23:31 UTC
Read the original article Hit count: 163

Filed under:
|
|

If I have this:

def array = [1,2,3,4,5,6]

Is there some built-in which allows me to do this ( or something similar ):

array.split(2)

and get:

[[1,2],[3,4],[5,6]]

?

© Stack Overflow or respective owner

Related posts about list

Related posts about groovy