小编Aru*_*run的帖子

Java 中 ArrayList 的最大容量是多少?

ArrayListJava中的最大容量是多少?由于ArrayList在内部使用数组,它的容量将是Integer.MAX_VALUE,对吗?

此代码显示的最大容量ArrayListInteger.MAX_VALUE

public class ArrayList<E> extends AbstractList<E>
    implements List<E>, RandomAccess, Cloneable, java.io.Serializable
{

transient Object[] elementData; // non-private to simplify nested class access

/**
 * The size of the ArrayList (the number of elements it contains).
 *
 * @serial
 */
private int size;
 /**
 * The maximum size of array to allocate (unless necessary).
 * Some VMs reserve some header words in an array.
 * Attempts to allocate larger arrays may …
Run Code Online (Sandbox Code Playgroud)

java arraylist

-4
推荐指数
1
解决办法
123
查看次数

标签 统计

arraylist ×1

java ×1