Package java.util

Interface Map.Entry<K,​V>

All Known Implementing Classes:
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry
Enclosing interface:
Map<K,​V>

public static interface Map.Entry<K,​V>
Map.Entry is a key/value mapping contained in a Map.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(Object object)
    Compares the specified object to this Map.Entry and returns if they are equal.
    K getKey()
    Returns the key.
    V getValue()
    Returns the value.
    int hashCode()
    Returns an integer hash code for the receiver.
    V setValue​(V object)
    Sets the value of this entry to the specified value, replacing any existing value.
  • Method Details

    • equals

      boolean equals​(Object object)
      Compares the specified object to this Map.Entry and returns if they are equal. To be equal, the object must be an instance of Map.Entry and have the same key and value.
      Overrides:
      equals in class Object
      Parameters:
      object - the Object to compare with this Object.
      Returns:
      true if the specified Object is equal to this Map.Entry, false otherwise.
      See Also:
      hashCode()
    • getKey

      K getKey()
      Returns the key.
      Returns:
      the key
    • getValue

      V getValue()
      Returns the value.
      Returns:
      the value
    • hashCode

      int hashCode()
      Returns an integer hash code for the receiver. Object which are equal return the same value for this method.
      Overrides:
      hashCode in class Object
      Returns:
      the receiver's hash code.
      See Also:
      equals(Object)
    • setValue

      V setValue​(V object)
      Sets the value of this entry to the specified value, replacing any existing value.
      Parameters:
      object - the new value to set.
      Returns:
      object the replaced value of this entry.