Hi,
Learnt that Vector class is synchronized. But looking at the javadoc for java.util.Vector I can't see the synchronized keyword mentioned in any of its method signature. Why ?
Printable View
Hi,
Learnt that Vector class is synchronized. But looking at the javadoc for java.util.Vector I can't see the synchronized keyword mentioned in any of its method signature. Why ?
Why you think that once the class is synchronized, methods must synchronized.
Then what do we mean when we say the Vector class is synchronized ?
I hope you know what's meaning on synchronized, right?
Vector class basically implements an array of objects. But the size can grow or shrink accordingly.
More details from the Java doc.
If you have read carefully, you can find the solution form there.Quote:
Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.