I'm new to Java and I would like to know how many values can a arraylist hold.
I'm building an android project that takes values from a database table (I'm printing the values using json and calling the file in java), and records this values on a arraylist.
If my table has like 8000 records, would it be possible to the arraylist hold all these records?
Thank you.
Since ArrayList in Java is backed by a built-in array, the limit on the size is equal the same as the limit on the size of an array, i.e. 2147483647.
Since your project is for android platform, you would run out of memory before reaching this limit. However, 8000 is a relatively small number. You could still run out of memory if each individual record takes a significant amount of memory, but it is going to happen before you hit the limit on the number of ArrayList entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With