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

Explain different forms of polymorphism?

886


Is java an open source?

742


What do you understand by the term polymorphism?

842


Can size_t be negative?

815


Which class is used by server applications to obtain a port and listen for client requests?

723


What is binary search in java?

799


Can a class be private or protected in java?

816


How is a variable stored in memory?

765


How do you include a string in java?

768


Should you use singleton pattern?

729


What are features of java?

786


What is the range of the short type?

797


How do you trim a space in java?

740


What are aggregate functions explain with examples?

807


Where are the card layouts used?

835