Class MapEntry<K,V>

Object
MapEntry<K,V>
Type Parameters:
K - The class of key elements.
V - The class of value elements.
All Implemented Interfaces:
Serializable, Map.Entry<K,V>

public class MapEntry<K,V> extends Object implements Map.Entry<K,V>, Serializable
A default implementation of Map.Entry which map an arbitrary key-value pairs. This entry is immutable by default.
Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapEntry(K key, V value)
    Creates a new map entry with the specified key-value pair.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Compares the specified object with this entry for equality.
    Returns the key corresponding to this entry.
    Returns the value corresponding to this entry.
    int
    Returns the hash code value for this map entry
    setValue(V value)
    Replaces the value corresponding to this entry with the specified value (optional operation).
    Returns a string representation of this entry.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MapEntry

      public MapEntry(K key, V value)
      Creates a new map entry with the specified key-value pair.
      Parameters:
      key - The key.
      value - The value.
  • Method Details

    • getKey

      public K getKey()
      Returns the key corresponding to this entry.
      Specified by:
      getKey in interface Map.Entry<K,V>
    • getValue

      public V getValue()
      Returns the value corresponding to this entry.
      Specified by:
      getValue in interface Map.Entry<K,V>
    • setValue

      public V setValue(V value)
      Replaces the value corresponding to this entry with the specified value (optional operation). The default implementation throws an UnsupportedOperationException.
      Specified by:
      setValue in interface Map.Entry<K,V>
    • equals

      public boolean equals(Object object)
      Compares the specified object with this entry for equality.
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
      Parameters:
      object - The object to compare with this entry for equality.
    • hashCode

      public int hashCode()
      Returns the hash code value for this map entry
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of this entry.
      Overrides:
      toString in class Object