# Enum Class CheckedContainer.Mutability

Object
Enum<CheckedContainer.Mutability>
Mutability

All Implemented Interfaces:
  `Serializable, Comparable<CheckedContainer​.Mutability>, Constable`

Enclosing interface:
  `CheckedContainer<E>`

public static enum CheckedContainer.Mutability extends Enum<CheckedContainer.Mutability>
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 Constants
  Enum Constant
  Description
  `IMMUTABLE`
  The container is immutable.
  `MODIFIABLE`
  The container is modifiable.
  `REMOVE_ONLY`
  The container supports only the removal of elements.
  `UNKNOWN`
  The mutability status of the container is unknown.
  `UNMODIFIABLE`
  The container is unmodifiable, but not necessarily immutable.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CheckedContainer​.Mutability`
  `of(Collection<?> collection)`
  Returns the mutability status of the given collection.
  `static CheckedContainer​.Mutability`
  `valueOf(String name)`
  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`

  ### Methods inherited from class Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### MODIFIABLE

    public static final CheckedContainer.Mutability MODIFIABLE
    The container is modifiable. Invoking a setter method should not cause `UnsupportedOperationException` to be thrown.

  - ### REMOVE_ONLY

    public static final CheckedContainer.Mutability REMOVE_ONLY
    The container supports only the removal of elements. Attempts to add or modify an element will cause `UnsupportedOperationException` to be thrown.

  - ### UNMODIFIABLE

    public static final CheckedContainer.Mutability UNMODIFIABLE
    The container is unmodifiable, but not necessarily immutable. Attempts to add, remove or add an element will cause `UnsupportedOperationException` to 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

    public static final CheckedContainer.Mutability IMMUTABLE
    The container is immutable. Its content does not change, and attempts to change the content will cause `UnsupportedOperationException` to be thrown.

  - ### UNKNOWN

    public static final CheckedContainer.Mutability UNKNOWN
    The mutability status of the container is unknown.

- ## Method Details

  - ### values

    public static CheckedContainer.Mutability[] 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

    public static CheckedContainer.Mutability valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null

  - ### of

    public static CheckedContainer.Mutability of(Collection<?> collection)
    Returns the mutability status of the given collection. If the given collection implements the `CheckedContainer` interface, then this method returns the `CheckedContainer​.getMutability()` status. Otherwise, this method tries to guess from the implementation class. In case of doubt, this method returns `UNKNOWN`.
    Parameters:
      `collection` - the collection for which to get the mutability status.
    Returns:
      mutability status of the given collection.