withCut

fun withCut(cutIndex: Int, newPosition: Int): DataPartition(source)

Returns a new partition with the cut at the supplied index moved to a new position. The receiver is not modified. The resulting cut positions must remain strictly increasing and within the data, otherwise an exception is thrown.

Parameters

cutIndex

the zero-based index of the interior cut to move, must be within 0 until (numGroups - 1)

newPosition

the new position for that cut