Class Pair<T1,T2>

java.lang.Object
org.apache.hadoop.hbase.util.Pair<T1,T2>
All Implemented Interfaces:
Serializable

@Public public class Pair<T1,T2> extends Object implements Serializable
A generic class for pairs.
See Also:
  • Field Details

  • Constructor Details

    • Pair

      public Pair()
      Default constructor.
    • Pair

      public Pair(T1 a, T2 b)
      Constructor
      Parameters:
      a - operand
      b - operand
  • Method Details

    • newPair

      public static <T1, T2> Pair<T1,T2> newPair(T1 a, T2 b)
      Constructs a new pair, inferring the type via the passed arguments
      Type Parameters:
      T1 - type for first
      T2 - type for second
      Parameters:
      a - first element
      b - second element
      Returns:
      a new pair containing the passed arguments
    • setFirst

      public void setFirst(T1 a)
      Replace the first element of the pair.
      Parameters:
      a - operand
    • setSecond

      public void setSecond(T2 b)
      Replace the second element of the pair.
      Parameters:
      b - operand
    • getFirst

      public T1 getFirst()
      Return the first element stored in the pair.
    • getSecond

      public T2 getSecond()
      Return the second element stored in the pair.
    • equals

      private static boolean equals(Object x, Object y)
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object