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


Please Help Members By Posting Answers For Below Questions

Is java code slower than native code?

779


What is java developer skills?

747


Define inheritance?

792


Does A Class Inherit The Constructors Of Its Superclass?

777


How dead lock situation occurs in java and how you can identify it?

752


Explain public static void main(string args[]).

863


explain multi-threading in java?

791


What is the use of volatile in java?

811


How do you compare objects in java?

704


Explain garbage collection in java?

749


Difference between stack and queue?

811


Is null or empty java?

763


What is the formula to calculate percentage?

757


What is comparable and comparator interface? List their differences

839


Which is better ascii or unicode?

766