addElements

open override fun addElements(index: Int, a: Array<out E?>, offset: Int, length: Int)

Insert a contiguous block of elements supplied as a raw array slice.

Preconditions checked:

  • offset and length must define a valid slice of a.

  • no element in slice may be null (throws NullPointerException).

  • each element's computed weight must be within bounds.

  • the block's weights must be non-decreasing internally.

  • the block must fit between neighbor weights at index.

On success, elements and weights are inserted as a contiguous block.

Parameters

index

insertion index

a

source array

offset

offset in a

length

number of elements to insert

Throws

for invalid index/offset/length

for null element in the array slice

if any weight is out of bounds or order/fit checks fail