Hi All,

I’d like to propose adding a small utility to ArrayUtils for partitioning
arrays into fixed-size chunks.

Currently, ListUtils.partition exists for lists, but there is no direct
equivalent for arrays in Commons Lang. Developers often write custom loops
to achieve the same result.

Proposed API example:

int[][] result = ArrayUtils.partition(new int[]{1, 2, 3, 4, 5}, 2);
// → [[1, 2], [3, 4], [5]]

Key points:

Supports primitive and object arrays.

Null-safe (returns empty array of arrays if input is null).

Consistent with ListUtils.partition behavior.

Small, general-purpose utility aligned with Lang’s focus on array helpers.


I’d like to check whether the community thinks this addition fits Lang’s
scope before opening a JIRA/PR.

Thanks,
Kushal

Reply via email to