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%
Vector vs Arraylist (in non-multithreading environment) – in which requirements we will use Vector
Share
In a single thread environment never user
Vector. Its methods are “synchronized” and this makes it slow, very slow againstArrayList.So event if the
ensureCapacitybehavior is different, andVectorincrease the size by 2, the cost of every single operation cannot be compared with the cost of theArrayListoperations, that are more fast.