Java Reference
In-Depth Information
There's one exception to that rule. Creating a synchronized collection will
not
give you a synchronized iterator
method—you have to manually synchronize the
Iterator
and
ListIterator
.
It's tempting to think that the methods prefixed with the word singleton represent the Singleton design pattern.
However, the intent of the methods is quite different. These methods do
not
ensure that you can have only one
instance of the collection object—they ensure that the collection can only contain a single element. Any attempt
to add or remove elements from the resulting collection will result in an
UnsupportedOperationException
.