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

What is return code?

570


What is the difference between final, finally and finalize()?

561


What is final modifier?

575


Is zero a natural number?

589


Is int a class in java?

541






Is string is a data type in java?

604


What is the name of the java compiler?

542


What is floating data type?

556


What is "this" keyword in java? Explain

676


Which is better stringbuffer or stringbuilder?

547


What is the use of predicate in java 8?

506


What is meant by flickering?

666


How do you use parseint in java?

528


Why set do not allow duplicates in java?

596


What is proper subset?

549