org.apache.commons.collections4.keyvalue

## Class UnmodifiableMapEntry<K,V>

- java.lang.Object
- - org.apache.commons.collections4.keyvalue.AbstractKeyValue<K,V>
  - - org.apache.commons.collections4.keyvalue.AbstractMapEntry<K,V>
    - - org.apache.commons.collections4.keyvalue.UnmodifiableMapEntry<K,V>

- All Implemented Interfaces:
    Map.Entry<K,V>, KeyValue<K,V>, Unmodifiable

      public final class UnmodifiableMapEntry<K,V>
      extends AbstractMapEntry<K,V>
      implements Unmodifiable

  A `Map.Entry` that throws UnsupportedOperationException when `setValue` is called.
  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnmodifiableMapEntry(KeyValue<? extends K,? extends V> pair)` Constructs a new entry from the specified `KeyValue`.
    `UnmodifiableMapEntry(K key, V value)` Constructs a new entry with the specified key and given value.
    `UnmodifiableMapEntry(Map.Entry<? extends K,? extends V> entry)` Constructs a new entry from the specified `Map.Entry`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `V` | `setValue(V value)` Throws UnsupportedOperationException.

    - ### Methods inherited from class org.apache.commons.collections4.keyvalue.AbstractMapEntry

      `equals, hashCode`

    - ### Methods inherited from class org.apache.commons.collections4.keyvalue.AbstractKeyValue

      `getKey, getValue, setKey, toString`

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

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

    - ### Methods inherited from interface java.util.Map.Entry

      `comparingByKey, comparingByKey, comparingByValue, comparingByValue, getKey, getValue`

- - ### Constructor Detail

    - #### UnmodifiableMapEntry

          public UnmodifiableMapEntry(K key,
                                      V value)

      Constructs a new entry with the specified key and given value.
      Parameters:
        `key` - the key for the entry, may be null
        `value` - the value for the entry, may be null

    - #### UnmodifiableMapEntry

          public UnmodifiableMapEntry(KeyValue<? extends K,? extends V> pair)

      Constructs a new entry from the specified `KeyValue`.
      Parameters:
        `pair` - the pair to copy, must not be null
      Throws:
        `NullPointerException` - if the entry is null

    - #### UnmodifiableMapEntry

          public UnmodifiableMapEntry(Map.Entry<? extends K,? extends V> entry)

      Constructs a new entry from the specified `Map.Entry`.
      Parameters:
        `entry` - the entry to copy, must not be null
      Throws:
        `NullPointerException` - if the entry is null

  - ### Method Detail

    - #### setValue

          public V setValue(V value)

      Throws UnsupportedOperationException.
      Specified by:
        `setValue` in interface `Map.Entry<K,V>`
      Overrides:
        `setValue` in class `AbstractMapEntry<K,V>`
      Parameters:
        `value` - the new value
      Returns:
        the previous value
      Throws:
        `UnsupportedOperationException` - always

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.