List最多可以容纳多少数据? [英] How much data can a List can hold at the maximum?

查看:34
本文介绍了List最多可以容纳多少数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中java.util.List最多可以添加多少数据?

How much data can be added in java.util.List in Java at the maximum?

ArrayList 是否有任何默认大小?

Is there any default size of an ArrayList?

推荐答案

这取决于 List 的实现.由于您使用 int 索引数组,ArrayList 不能容纳多于 Integer.MAX_VALUE 的元素.但是,LinkedList 不受相同方式的限制,可以包含任意数量的元素.

It depends on the List implementation. Since you index arrays with ints, an ArrayList can't hold more than Integer.MAX_VALUE elements. A LinkedList isn't limited in the same way, though, and can contain any amount of elements.

这篇关于List最多可以容纳多少数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆