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
Why 1 is not a prime number?
What are the major drawbacks of external iteration?
How do you access command-line arguments within the code?
What is reverse function?
What is a 16 bit word?
Can a abstract class be defined without any abstract methods?
what is the difference between Object Based Language and Object Oriented Language?
What is the difference between array and array list in java?
Define interface in java?
What is integers and example?
What are constants?
Can we inherit a class with private constructor?
What is the difference between JVM and JRE?
Can we override final method?
How do you remove duplicates from an array in java?