maxLength method
If the list has more than maxLength
elements, removes the last elements so it remains
with only maxLength
elements. If the list has maxLength
or less elements, doesn't
change anything.
Implementation
L<T> maxLength(int maxLength) => maxLength < 0
? throw ArgumentError(maxLength)
: length <= maxLength
? this
: LFlat<T>.unsafe(unlock..length = maxLength);