首页javalistJava Collection - 如何检查容量

Java Collection - 如何检查容量

我们想知道如何检查容量。

The capacity is the number of elements the array list can hold before the internal data structure has to resize.

Use the ensureCapacity() method to check that the internal data structure has enough capacity before adding elements:

public void ensureCapacity(int minimumCapacity)