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
State the significance of public, private, protected class?
what do you mean by java annotations?
Can we sort arraylist in java?
What is the role of garbage collector in java?
What is the use of math abs in java?
how to write a server program and sending the mails to the server using smtp protocol please help me
How many types of methods are there?
What happens when heap memory is full?
What is the map interface in java programming?
What method is used to specify a container's layout in java programming?
Can I learn java in 3 months?
Can a lock be acquired on a class in java programming?
Give me example of derived data types.
How do you generate random numbers in java?
What is ide with example?