Such exceptions are marked as "optional" in the specification for this interface.It is up to each collection to determine its own synchronization policy.Enull :.equals(e)." This specification should not be construed to imply that invoking ntains with a non-null argument o will cause.equals(e) to be invoked for any element.

The "destructive" methods contained in this interface, that is, the methods that modify the collection on which they operate, are specified to throw.Many methods in Collections Framework interfaces are defined in terms of the equals method.

For example, invoking the addAll(Collection) method on an unmodifiable collection may, but is not required to, throw the exception if the collection to be added is empty.In effect, the latter constructor allows the user to copy any collection, producing an equivalent collection of the desired implementation type.For example, some implementations prohibit null elements, and some have restrictions on the types of their elements.