what is the diff b/w arraylist and vector?

Answer Posted / umanath

Vector and ArrayList are very similar. Both of them
represent a 'growable array',
ArrayList it's part of the Java Collection Framework, and
has been added with version 1.2, Vector it's an object that
is present since the first version of the JDK.
The main difference is that Vector it's a synchronized
object, while ArrayList it's not.
While the iterator that are returned by both classes are
fail-fast (they cleanly thrown a
ConcurrentModificationException when the original object has
been modified), the Enumeration returned by Vector are not.

Unless you have strong reason to use a Vector, the
suggestion is to use the ArrayList.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to display arraylist values in java?

490


Does java runtime require a license?

576


What do you mean by hashing?

641


What is the meaning of 3 dots in java?

680


When do we need to use internal iteration? When do we need to use external iteration?

604






What are loops in java?

548


How to run a JAR file through command prompt?

715


What is the difference between static (class) method and instance method?

569


Describe the Big-O Notation.

615


What is java object name?

549


What are the two types of exceptions in java? Which are the differences between them?

510


Why is sizeof not a function?

545


How to implement a multithreaded applet?

2201


Give me an example of array and linked list? Where they can be used?

553


What do you understand by abstract classes?

600