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

State the significance of public, private, protected class?

881


what do you mean by java annotations?

810


Can we sort arraylist in java?

806


What is the role of garbage collector in java?

752


What is the use of math abs in java?

774


how to write a server program and sending the mails to the server using smtp protocol please help me

1820


How many types of methods are there?

771


What happens when heap memory is full?

772


What is the map interface in java programming?

803


What method is used to specify a container's layout in java programming?

809


Can I learn java in 3 months?

793


Can a lock be acquired on a class in java programming?

759


Give me example of derived data types.

868


How do you generate random numbers in java?

784


What is ide with example?

748