public void trimToSize()
Trims the capacity of this ArrayList instance to be the list's current size. An application can use this operation to minimize the storage of an ArrayList instance.
ensureCapacity
public void ensureCapacity(int minCapacity)
Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
Parameters:
minCapacity - the desired minimum capacity
size
public int size()
Returns the number of elements in this list.
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection
Returns:
the number of elements in this list
isEmpty
public boolean isEmpty()
Returns true if this list contains no elements.
On this page of the site you can watch the video online Java ArrayList Methods with a duration of hours minute second in good quality, which was uploaded by the user Learning Point By Engineers 17 February 2024, share the link with friends and acquaintances, this video has already been watched 71 times on youtube and it was liked by 11 viewers. Enjoy your viewing!