Class Dictionary.Pair<K,​V>

  • Type Parameters:
    K - Type of the key part of the pair.
    V - Type of the value in the pair.
    All Implemented Interfaces:
    java.io.Serializable
    Enclosing interface:
    Dictionary<K,​V>

    public static final class Dictionary.Pair<K,​V>
    extends java.lang.Object
    implements java.io.Serializable
    Class representing a key/value pair.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      K key
      The "key" of this key-value pair.
      V value
      The "value" of this key-value pair.
    • Constructor Summary

      Constructors 
      Constructor Description
      Pair​(K newKey, V newValue)
      The only constructor for this class that takes both the key and the value to be stored, ensuring they are both set all the time.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object object)  
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • key

        public final K key
        The "key" of this key-value pair.
      • value

        public final V value
        The "value" of this key-value pair.
    • Constructor Detail

      • Pair

        public Pair​(K newKey,
                    V newValue)
        The only constructor for this class that takes both the key and the value to be stored, ensuring they are both set all the time.
        Parameters:
        newKey - The "key" to be stored.
        newValue - The "value" to be associated with that key.
        Throws:
        java.lang.IllegalArgumentException - if the key is null.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object