Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.5
-
Fix Version/s: 1.8.6, 2.0-beta-3
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
I have often found a need for collating or partitioning a List into a List of sub-lists of a given size.
This question has been asked on StackOverflow a couple of times as well
ie:
[1,2,3,4,5].collate( 3 ) == [ [ 1, 2, 3 ], [ 4, 5 ] ]
This could be chained to generate a multi-dimensional list of lists, ie:
(1..9).collate( 3 ).collate( 2 ) == [ [ [1,2,3], [4,5,6] ],
[ [7,8,9] ] ]
Activity
Guillaume Laforge
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Guillaume Laforge [ guillaume ] |
Guillaume Laforge
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0-beta-3 [ 18244 ] | |
| Fix Version/s | 1.8.6 [ 18245 ] | |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
And this generated my first pull request of (hopefully) many:
https://github.com/groovy/groovy-core/pull/22