Is there a longer than int Java List?

后端 未结 3 874
谎友^
谎友^ 2020-12-19 16:47

I can\'t seem to find a Java List that\'s max length is long\'s max value.

Does such a List exist?

If so, where?

3条回答
  •  渐次进展
    2020-12-19 17:17

    As List.get(int) accepts int as its argument, it is impossible to address entries with indexes greater than Integer.MAX_VALUE.

    Do note, however, that Iterable or Map can address much more data. As List implements Iterable it could contain any amount of data (that part being not exposed with int-based List's API).

提交回复
热议问题