for Each Window
inline fun <T> List<T>.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceSubList<T>) -> Unit)(source)
Iterates through the windows of the list 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.
Throws
if windowSize or step is less than or equal to 0.