Package org.apache.commons.collections4.map

# Class UnmodifiableEntrySet<K,V>

java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<Map.Entry<K,V>>
org.apache.commons.collections4.set.AbstractSetDecorator<Map.Entry<K,V>>
org.apache.commons.collections4.map.UnmodifiableEntrySet<K,V>

Type Parameters:
  `K` - The type of the keys in the map
  `V` - The type of the values in the map

All Implemented Interfaces:
  `Serializable`, `Iterable<Map.Entry<K,V>>`, `Collection<Map.Entry<K,V>>`, `Set<Map.Entry<K,V>>`, `Unmodifiable`

public final class UnmodifiableEntrySet<K,V> extends AbstractSetDecorator<Map.Entry<K,V>> implements Unmodifiable
Decorates a map entry `Set` to ensure it can't be altered.

Attempts to modify it will result in an UnsupportedOperationException.

Since:
  3.0
See Also:
  - Serialized Form

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(Map.Entry<K,V> object)`
  Always throws `UnsupportedOperationException`.
  `boolean`
  `addAll(Collection<? extends Map.Entry<K,V>> coll)`
  Always throws `UnsupportedOperationException`.
  `void`
  `clear()`
  Always throws `UnsupportedOperationException`.
  `Iterator<Map.Entry<K,V>>`
  `iterator()`
  `boolean`
  `remove(Object object)`
  Always throws `UnsupportedOperationException`.
  `boolean`
  `removeAll(Collection<?> coll)`
  Always throws `UnsupportedOperationException`.
  `boolean`
  `removeIf(Predicate<? super Map.Entry<K,V>> filter)`
  Always throws `UnsupportedOperationException`.
  `boolean`
  `retainAll(Collection<?> coll)`
  Always throws `UnsupportedOperationException`.
  `Object[]`
  `toArray()`
  `<T> T[]`
  `toArray(T[] array)`
  `static <K, V> Set<Map.Entry<K,V>>`
  `unmodifiableEntrySet(Set<Map.Entry<K,V>> set)`
  Factory method to create an unmodifiable set of Map Entry objects.

  ### Methods inherited from class org.apache.commons.collections4.set.AbstractSetDecorator

  `decorated, equals, hashCode`

  ### Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator

  `contains, containsAll, isEmpty, setCollection, size, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Collection

  `parallelStream, stream`

  ### Methods inherited from interface java.lang.Iterable

  `forEach`

  ### Methods inherited from interface java.util.Set

  `contains, containsAll, isEmpty, size, spliterator`

- ## Method Details

  - ### unmodifiableEntrySet

    public static <K, V> Set<Map.Entry<K,V>> unmodifiableEntrySet(Set<Map.Entry<K,V>> set)
    Factory method to create an unmodifiable set of Map Entry objects.
    Type Parameters:
      `K` - the key type
      `V` - the value type
    Parameters:
      `set` - The set to decorate, must not be null
    Returns:
      A new unmodifiable entry set
    Throws:
      `NullPointerException` - if set is null
    Since:
      4.0

  - ### add

    public boolean add(Map.Entry<K,V> object)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `add` in interface `Collection<K>`
    Specified by:
      `add` in interface `Set<K>`
    Overrides:
      `add` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `object` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### addAll

    public boolean addAll(Collection<? extends Map.Entry<K,V>> coll)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `addAll` in interface `Collection<K>`
    Specified by:
      `addAll` in interface `Set<K>`
    Overrides:
      `addAll` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `coll` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### clear

    public void clear()
    Always throws `UnsupportedOperationException`.
    Specified by:
      `clear` in interface `Collection<K>`
    Specified by:
      `clear` in interface `Set<K>`
    Overrides:
      `clear` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### iterator

    public Iterator<Map.Entry<K,V>> iterator()
    Specified by:
      `iterator` in interface `Collection<K>`
    Specified by:
      `iterator` in interface `Iterable<K>`
    Specified by:
      `iterator` in interface `Set<K>`
    Overrides:
      `iterator` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`

  - ### remove

    public boolean remove(Object object)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `remove` in interface `Collection<K>`
    Specified by:
      `remove` in interface `Set<K>`
    Overrides:
      `remove` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `object` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### removeAll

    public boolean removeAll(Collection<?> coll)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `removeAll` in interface `Collection<K>`
    Specified by:
      `removeAll` in interface `Set<K>`
    Overrides:
      `removeAll` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `coll` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### removeIf

    public boolean removeIf(Predicate<? super Map.Entry<K,V>> filter)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `removeIf` in interface `Collection<K>`
    Overrides:
      `removeIf` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `filter` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.
    Since:
      4.4

  - ### retainAll

    public boolean retainAll(Collection<?> coll)
    Always throws `UnsupportedOperationException`.
    Specified by:
      `retainAll` in interface `Collection<K>`
    Specified by:
      `retainAll` in interface `Set<K>`
    Overrides:
      `retainAll` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`
    Parameters:
      `coll` - Ignored.
    Throws:
      `UnsupportedOperationException` - Always thrown.

  - ### toArray

    public Object[] toArray()
    Specified by:
      `toArray` in interface `Collection<K>`
    Specified by:
      `toArray` in interface `Set<K>`
    Overrides:
      `toArray` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`

  - ### toArray

    public <T> T[] toArray(T[] array)
    Specified by:
      `toArray` in interface `Collection<K>`
    Specified by:
      `toArray` in interface `Set<K>`
    Overrides:
      `toArray` in class `AbstractCollectionDecorator<Map.Entry<K,V>>`