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

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

问题描述

最多可以在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 s索引数组,因此 ArrayList 不能超过整数。 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.

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

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