what is the difference between ArrayList and Vector
Answer Posted / janardhan
ArrayList contains all methods are non-synchronized methods.
ArrayList by default not threadsafe.
ArrayList allows duplicate objects.
ArrayList default size is 16.if you want to increase size
use this formula:-- defaultsize * 3/2 + 1.
we can make araylist as synchronised:--
List l=Collections.SynchronizedList(new arrayList());
Arraylist is best choice for retrival operation and worest
choice for insert operation.
Vector:--
Vector is same like arraylist, but we have only one
difference is vector contains all synchronized methods.
Vector is best choice for retrival operation and worest
choice for insert operation.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are the different ways to handle exceptions?
What is the use of arrays tostring () in java?
Why hashcode is used in java?
What is difference between static class and singleton pattern?
Can string be considered as a keyword?
What is a dynamic array java?
What are mutable classes?
What does system out println () do?
Is java owned by oracle?
Explain the difference between protected and default access.
What are the differences between heap and stack memory in java?
In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?
What are static blocks and static initalizers in java ?
What does the three dot emoji mean?
What is widening and narrowing in java? Discuss with an example.