What is the difference between length () and size () of arraylist?



What is the difference between length () and size () of arraylist?..

Answer / Kundan Kumar Vats

length() returns the number of elements in the underlying array, regardless of whether all positions are occupied or not. size() returns the number of elements currently stored in the ArrayList.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

Write a Program for Delete an element from a doubly linked list.

1 Answers  


Convert following infix expression to the prefix expression. a - b + c * (d / e - (f + g))

33 Answers   Amazon, Microsoft, Star Technologies, Sun Microsystems, Wipro,


Is priority queue sorted?

1 Answers  


What is heap and its types?

1 Answers  


Is hashset a collection?

1 Answers  


Define a relation?

1 Answers  


Difference between calloc and malloc ?

1 Answers  


Is duplicate allowed in hashmap?

1 Answers  


Which file contains the definition of member functions?

1 Answers  


What does enum do?

1 Answers  


What is sort order?

1 Answers  


What is ordered map?

1 Answers  


Categories