Class MapItem<Key,Value>

java.lang.Object
dsa.lab04.base.MapItem<Key,Value>
Type Parameters:
Key - the key type
Value - the value type

public class MapItem<Key,Value> extends Object
An item in a map.
See Also:
  • Constructor Details

    • MapItem

      public MapItem(Key key, Value value)
      Construct a map item.
      Parameters:
      key - the key
      value - the value
  • Method Details

    • key

      public Key key()
      Get the key (the unique/identifying part of the item).
      Returns:
      the key
    • value

      public Value value()
      Get the value (the rest of the item, or the corresponding value, depending on your view).
      Returns:
      the value
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object