Enum Class CheckedContainer.Mutability
- All Implemented Interfaces:
Serializable, Comparable<CheckedContainer.Mutability>, Constable
- Enclosing interface:
CheckedContainer<E>
Mutability status of a container.
- Since:
- 1.6
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe container is immutable.The container is modifiable.The container supports only the removal of elements.The mutability status of the container is unknown.The container is unmodifiable, but not necessarily immutable. -
Method Summary
Modifier and TypeMethodDescriptionof(Collection<?> collection) Returns the mutability status of the given collection.Returns the enum constant of this class with the specified name.static CheckedContainer.Mutability[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
MODIFIABLE
The container is modifiable. Invoking a setter method should not causeUnsupportedOperationExceptionto be thrown. -
REMOVE_ONLY
The container supports only the removal of elements. Attempts to add or modify an element will causeUnsupportedOperationExceptionto be thrown. -
UNMODIFIABLE
The container is unmodifiable, but not necessarily immutable. Attempts to add, remove or add an element will causeUnsupportedOperationExceptionto be thrown. However, the content of the collection way still change with time, for example if the collection is a view and the underlying view changes. -
IMMUTABLE
The container is immutable. Its content does not change, and attempts to change the content will causeUnsupportedOperationExceptionto be thrown. -
UNKNOWN
The mutability status of the container is unknown.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
of
Returns the mutability status of the given collection. If the given collection implements theCheckedContainerinterface, then this method returns theCheckedContainer.getMutability()status. Otherwise, this method tries to guess from the implementation class. In case of doubt, this method returnsUNKNOWN.- Parameters:
collection- the collection for which to get the mutability status.- Returns:
- mutability status of the given collection.
-