Class Pair<K,V>

java.lang.Object
com.amilesend.client.util.Pair<K,V>
Type Parameters:
K - the key or left
V - the value or right
All Implemented Interfaces:
Map.Entry<K,V>

public class Pair<K,V> extends Object implements Map.Entry<K,V>
A simple tuple class that references two objects.
  • Constructor Details

    • Pair

      public Pair(K left, V right)
      Creates a new Pair instance.
      Parameters:
      left - The left reference.
      right - the right reference.
  • Method Details

    • of

      public static <K, V> Pair<K,V> of(K left, V right)
      Creates a new Pair for the given left and right objects.
      Type Parameters:
      K - the left object class type
      V - the right object class type
      Parameters:
      left - the left object
      right - the right object
      Returns:
      the tuple
    • getKey

      public K getKey()
      Specified by:
      getKey in interface Map.Entry<K,V>
    • getValue

      public V getValue()
      Specified by:
      getValue in interface Map.Entry<K,V>
    • setValue

      public V setValue(V value)
      Specified by:
      setValue in interface Map.Entry<K,V>
    • getLeft

      public K getLeft()
      The left reference.
    • getRight

      public V getRight()
      the right reference.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object