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
What is the maximum length of a url?
What is variable and its types?
What if constructor is protected in java?
What is method in java with example?
Do I need to import java.lang package any time? Why?
In the below example, how many string objects are created?
Can you sort a list in java?
What is time complexity algorithm?
What is array pointers ?
what is meant by encapsulation?
Can this keyword be used to refer static members?
What is the major drawback of internal iteration over external iteration?
Can a class be final?
Which collection is ordered in java?
List some important features of java 10 release?