• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arraylist Size

 
shruti patel
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many number of objects we can store in an ArrayList. Is
there any limit?
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ArrayList uses arrays internally. These have a limit of Integer.MAX_VALUE. Therefore, that is also the limit of ArrayLists.

LinkedList on the other hand has no limit at all; if the size is larger than Integer.MAX_VALUE then size() will return Integer.MAX_VALUE.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as your JVM is not out of memory , you can store any number of objects !
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
ArrayList uses arrays internally. These have a limit of Integer.MAX_VALUE. Therefore, that is also the limit of ArrayLists.



Thanks Rob, I haven`t known that !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic