Does the Vector class of Java have a limit to the amount of elements it can store? I know it automatically grows and should be able to store an arbitrary amount of elements, however are there any limitations that limit the amount of elements you can actually store? Other than the most obvious limitation like running out of memory.
Share
There are two limits:
Integer.MAX_VALUE), since elements in the underlying array are indexed by an integer indexSide note: if you plan to use Vector, then don’t. Use ArrayList instead, which is not synchronized and fits better with the rest of the Collections framework.