Trims the capacity of this list instance to be the list's current size.
Trims the capacity of this list instance to be the list's current size.For linked list this call returns the list's size.
If the list is an array list and if the capacity is actually decreased, this method has a time complexity of O(N), with N being the number of elements in the list.
In all other cases this method has a time complexity of O(1).