On Fri, 5 Sept 2025 at 18:46, Kushal Dixit <[email protected]> wrote:
>
> 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.

What use cases are there for this?

> Thanks,
> Kushal

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to