Vector vs Arraylist (in non-multithreading environment) – in which requirements we will use Vector (rather than ArrayList)
One I know : if the size of the collection has to be increased dynamically and very frequently as vector size increases by 100% and ArrayList 50%
Asked
Active
Viewed 88 times
0

lowLatency
- 5,534
- 12
- 44
- 70
2 Answers
1
I think you should not use vector because you have to syncronized(also non-threaded environment) ,So Use ArrayList
Vector is syncronized each operation ,do not whole operation and .....and its also deprecated... Why is Java Vector class considered obsolete or deprecated?

Community
- 1
- 1

Samir Mangroliya
- 39,918
- 16
- 117
- 134
0
In a single thread environment never user Vector
. Its methods are "synchronized" and this makes it slow, very slow against ArrayList
.
So event if the ensureCapacity
behavior is different, and Vector
increase the size by 2, the cost of every single operation cannot be compared with the cost of the ArrayList
operations, that are more fast.

dash1e
- 7,677
- 1
- 30
- 35