Howmany number of objects we can store in an ArrayList. Is
there any limit?
Answers were Sorted based on User's Feedback
Answer / abdul
Array list size will increase dynamically.By default we can
store 16 objects.If number of objects increases the
arraylist size increase dynamically as below.
(2*Prevous size+2)
For ex: (2*16+2)=34 next time
(2*34+2)= 70
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / phanindra
ArrayList is resizeable in nature. by default it's size is
10. whenever it reaches the maximum a new ArrayList object
will be created with capacity of (Initialcapacity*3/2+1)
so there is no Limit we can store any number of objects in
an ArrayList.
| Is This Answer Correct ? | 1 Yes | 0 No |
It depends on list implementation.Since ArrayList is backed by an arrays so its size is limited to Integer.MAX_VALUE
and it can't hold more than interger.MAX_VALUE.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can we pass a primitive type by reference in java? How
I want to run a simple hello world java (HelloWorld.java) program using a batch file. How can i run it and how to construct a batch file.
When does Exception occurs?
What is user defined exception in Java?
When will we prefer to use set and list in java and why?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What exceptions occur during serialization?
what is marker interface ? what is the necessity of it?
Java is pass by value or pass by reference? Explain
What is the difference between a local variable and an instance variable?
can java object be locked down for exclusive use by a given thread? : Java thread
what is the purpose of method overriding in java where v r completely re-defining a inherited method instead y can't v create a new method and define.If the question is very silly plz excuse me and do reply.Thank U!
7 Answers emc2, Kumaran Systems,