Package groovy.util

Class MapEntry

java.lang.Object
groovy.util.MapEntry
All Implemented Interfaces:
Map.Entry

public class MapEntry extends Object implements Map.Entry
A Map.Entry implementation.
  • Constructor Details

    • MapEntry

      public MapEntry(Object key, Object value)
      Creates a map entry with the supplied key and value.
      Parameters:
      key - the entry key
      value - the entry value
  • Method Details

    • equals

      public boolean equals(Object that)
      Specified by:
      equals in interface Map.Entry
      Overrides:
      equals in class Object
    • equals

      public boolean equals(MapEntry that)
      Compares this entry with another MapEntry.
      Parameters:
      that - the entry to compare with
      Returns:
      true if both key and value are equal
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getKey

      public Object getKey()
      Specified by:
      getKey in interface Map.Entry
    • setKey

      public void setKey(Object key)
      Updates the entry key.
      Parameters:
      key - the new key
    • getValue

      public Object getValue()
      Specified by:
      getValue in interface Map.Entry
    • setValue

      public Object setValue(Object value)
      Specified by:
      setValue in interface Map.Entry
    • hash

      protected int hash(Object object)
      Helper method to handle object hashes for possibly null values