for Each Window Indexed
inline fun <T> List<T>.forEachWindowIndexed(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (index: Int, InPlaceSubList<T>) -> Unit)(source)
Iterates through the windows of the list with their indices and performs the given action on each window.
Parameters
window Size
The desired size of each window. Must be greater than 0.
step
The step size between consecutive windows. Must be greater than 0, Defaults to 1.
partial Windows
Whether or not to include partial windows at the end of the list if any. Defaults to false.
action
The function to be executed for each window and its index.
Throws
if windowSize or step is less than or equal to 0.