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
How do you add an element to an arraylist in java?
What is the use of default method in interface in java?
What is immutable in java?
What is anonymous inner class?
What environment variables do I need to set on my machine in order to be able to run java programs?
What is the meaning of flag day?
What is structure of java heap? What is perm gen space in heap?
Explain about static nested classes in java?
How many bytes is a string?
Explain wrapper classes in java?
Why string is not a wrapper class?
How do you do math powers in java?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
What is the difference between a switch statement and an if statement?
How to perform linear search in java?