chunked method

  1. @useResult
KtList<KtList<T>> chunked(
  1. int size
)

Splits this collection into a list of lists each not exceeding the given size.

The last list in the resulting list may have less elements than the given size.

@param size the number of elements to take in each list, must be positive and can be greater than the number of elements in this collection.

Implementation

@useResult
KtList<KtList<T>> chunked(int size) {
  return windowed(size, step: size, partialWindows: true);
}