forEachWindow

inline fun IntList.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceIntSubList) -> Unit)(source)
inline fun LongList.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceLongSubList) -> Unit)(source)
inline fun FloatList.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceFloatSubList) -> Unit)(source)
inline fun DoubleList.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceDoubleSubList) -> Unit)(source)

Iterates through the windows of the list and performs the given action on each window.

Parameters

windowSize

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.

partialWindows

Whether to include partial windows at the end. Defaults to false.

action

The function to be executed for each window.

Throws

if windowSize or step is less than or equal to 0.