size

open override fun size(size: Int)

Resize the list to the given size (shrinking only).

Behavior:

  • If size< 0 => IllegalArgumentException.

  • If size current size => UnsupportedOperationException (growing not supported).

  • If size <= current size => trims both items and weights to the given size.

This method manipulates internal arrays directly and is used by internal routines.