Hi,
Which of the methods of java Vector class is synchronized.Since there is no explicit synchronized in javadoc.
Hi,
Which of the methods of java Vector class is synchronized.Since there is no explicit synchronized in javadoc.
All methods of the Vector class that change the state of the vector are synchronized.
The explanation is in the last line of the class Javadoc:
Unlike the new collection implementations, Vector is synchronized.
Vector is essentially a synchronized ArrayList
In the absence of explicit statements in the Javadoc, look at the source code. For instance, you can find them in the src.zip file in your JDK installation.
In fact, nearly all methods that access or update the state of the Vector synchronize at some point. However, the Iterator returned by iterator() and the Enumeration returned by elements() only synchronize during next / hasNext calls.