what is the diff b/w arraylist and vector?

Answers were Sorted based on User's Feedback



what is the diff b/w arraylist and vector?..

Answer / shweta dhankani

Above answer is wrong..
Infact it is opposite..
Vector methods are synchronized and are thread safe.
Whereas Arraylist methods are not synchronized and thread safe.

Is This Answer Correct ?    30 Yes 0 No

what is the diff b/w arraylist and vector?..

Answer / aravind

1. Arraylist is not synchronized while vector is.
2. Arraylist has no default size while vector has a
default size of 10.
3. Arraylist don't define any increment size while vector
does.
4. Arraylist can be seen directly without any iterator
while vector requires an iterator to display all it's
content. (not very sure).

Is This Answer Correct ?    5 Yes 3 No

what is the diff b/w arraylist and vector?..

Answer / 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

what is the diff b/w arraylist and vector?..

Answer / mari

vector intriduced in 1.0 version thats why we called vector
is a legecy.and AL(1.2) is non legecy

Is This Answer Correct ?    0 Yes 0 No

what is the diff b/w arraylist and vector?..

Answer / srikanth reddy

Vector and ArrayList are very similar. Both of them
represent a 'growable array'

arraylist class is added in java/j2ee where has vector class
is before to jdk1.4 they just taken as it as in jdk1.4

the main difference is that Vector it's a synchronized
object, while ArrayList it's not.

for accesing elements of arraylist we can use iterator

for accesing elements of vectorlist we can use both iterator
and enumeraation

arraylist is faster in acessing of elements compared to
vector class

Is This Answer Correct ?    0 Yes 0 No

what is the diff b/w arraylist and vector?..

Answer / rajesh_mari24

arraylist methods are synchronized.so all methods are thread
safe.performance is very low.it introduced in 1.2 ver
vector methods are non synchronized.so all methods are not
thread safe.performance is high.it introduced in 1.0 ver

Is This Answer Correct ?    5 Yes 37 No

Post New Answer

More Core Java Interview Questions

What does += mean in java?

0 Answers  


What will be the output of the program? public class Test { public static void main(String args[]) { ArrayList<String> list = new ArrayList<String>(); list.add("2"); list.add("3"); list.add("4"); list.add("5"); System.out.println("size :"+list.size()); for(int i=0;i<list.size();i++) { list.remove(i); } System.out.println("size after:"+list.size()); } }

5 Answers   Rolta,


How do we access static members in java?

0 Answers  


How does enum work in java?

0 Answers  


Can a class extend 2 classes in java?

0 Answers  






How do I convert a string to an int in java?

0 Answers  


Explain the hierarchy of java exception classes?

0 Answers  


How are this and super used?

7 Answers   IBM,


What is a modifier?

1 Answers  


Is java util list serializable?

0 Answers  


what is object slice?

0 Answers  


Why super is first line in java?

0 Answers  


Categories