sdk-common / com.tomtom.online.sdk.common.functional.collections / Lists / partition

partition

@NonNull static fun <A : Any!> partition(@NonNull list: MutableList<A>, upperBound: Int): MutableList<MutableList<A>!>

Splits a List into Lists with an arity of 2 where each List has an inclusive upper bound on its size.

Parameters

list - MutableList<A>: List to transform.

upperBound - Int: Inclusive upper bound on the size for each List.

- Value type.

Exceptions

IllegalArgumentException - If the inclusive upper bound is less than 1.

Return
MutableList<MutableList<A>!>: Partitioned List.