What methods of the Java Vector class are synchronized?

Which of the methods of the java Vector class is synchronized. Since there is no explicit synchronization in javadoc.

+3
source share
3 answers

All methods of the Vector class that change the state of a vector are synchronized.

+3
source

The explanation given in the last row of the class of the Javadoc :

Unlike new collection implementations, the vector is synchronized.

Vector essentially synchronized ArrayList

+2
source

Javadoc . , src.zip JDK.

In fact, almost all methods that provide access or update the Vector synchronization state at some point. However Iterator, the returned one iterator(), and the Enumerationreturned one elements(), only synchronizes during the next / hasNext calls.

0
source

Source: https://habr.com/ru/post/1751130/


All Articles