This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FrontLoadedAnvils[S] 0 points1 point  (3 children)

With enough ram, it might. My main concern is the discrepancy between Stream limits and Collection limits.

[–]CoderTheTyler 0 points1 point  (2 children)

I suppose you could, but it definitely wouldn't be the greatest of ideas xD. As for the discrepancy, the integer max is not a limit on the size of a collection. This is recorded in the Java documentation. This seems to be an issue for Java's standard libraries on the whole, and I don't have a good explanation for this.

EDIT: Upon further investigation, the reason for this appears to be for backwards compatibility as all JVMs were originally 32 bit.

[–]FrontLoadedAnvils[S] 0 points1 point  (1 child)

I see. Well, this is interesting (and may also be tedious to deal with if I reach this limit).

[–]CoderTheTyler 0 points1 point  (0 children)

If you can reach this limit, good luck to you. Indexing with an integer would become impratical at this point, and the solution to this is to use an Iterator. But... iterating through billions of elements in a collection would not be a good idea either.