ArrayList v/s Vector |
Expect this question in a junior level (0-2 yrs) interview. One of the most done to death and still kicking question. This questions lays the foundation of advanced level question.
Let's see the differences one by one.
S No.
|
Arraylist
|
Vector
|
1
|
Non Synchronized and hence not
thread safe
|
Synchronized and Thread safe
|
2
|
Faster performance as non-synchronized
|
Slower performance as only one thread access at a
time.
|
3
|
Array increase the size by 50%
when full (Starting Size 10 by default)
|
Vector doubles the size when
full.
|
4
|
Uses Iterator for iteration
|
Uses Enumerator for iteration
|
No comments:
Post a Comment