Package generic

Class DominantPair<K,​V>

  • Type Parameters:
    K - the key type
    V - the value type

    public class DominantPair<K,​V>
    extends Pair<K,​V>
    DominantPair is a pair where the key is responsible for equality and hashCode (and the value of the pair doesn't matter at all). This is useful when you need the pair itself to function as a key in a Map or value in a Set.
    • Constructor Summary

      Constructors 
      Constructor Description
      DominantPair​(K key, V value)  
    • Method Summary

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

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

      • DominantPair

        public DominantPair​(K key,
                            V value)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Pair<K,​V>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Pair<K,​V>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Pair<K,​V>