padWith

inline fun <T> Sequence<T>.padWith(size: Int, inserter: (Sequence<T>) -> Sequence<T>): Sequence<T>(source)

Pads this sequence to the specified size using a custom inserter function. The inserter is repeatedly called until the sequence reaches the desired size.

Return

A sequence padded to at least the specified size

Parameters

size

The target size of the padded sequence

inserter

A function that takes the current sequence and returns a new padded sequence

Type Parameters

T

The type of elements in the sequence


inline fun <T> List<T>.padWith(size: Int, inserter: (List<T>) -> List<T>): List<T>(source)

Pads this list to the specified size using a custom inserter function. The inserter is repeatedly called until the list reaches the desired size.

Return

A list padded to at least the specified size

Parameters

size

The target size of the padded list

inserter

A function that takes the current list and returns a new padded list

Type Parameters

T

The type of elements in the list