size
Resize the list to the given size (shrinking only).
Behavior:
If
size< 0 => IllegalArgumentException.If
sizecurrent 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.