org.apache.hadoop.hbase.util
Class Pair<T1,T2>

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

public final class Pair<T1,T2>
extends Object
implements Serializable

A generic class for immutable pairs.

See Also:
Serialized Form

Field Summary
protected  T1 first
           
protected  T2 second
           
 
Constructor Summary
Pair(T1 a, T2 b)
          Constructor
 
Method Summary
 boolean equals(Object other)
           
 T1 getFirst()
          Return the first element stored in the pair.
 T2 getSecond()
          Return the second element stored in the pair.
 int hashCode()
           
static
<T1,T2> Pair<T1,T2>
of(T1 one, T2 two)
          Creates a new instance of the pair encapsulating the supplied values.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

protected T1 first

second

protected T2 second
Constructor Detail

Pair

public Pair(T1 a,
            T2 b)
Constructor

Parameters:
a -
b -
Method Detail

getFirst

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

Returns:
T1

getSecond

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

Returns:
T2

of

public static <T1,T2> Pair<T1,T2> of(T1 one,
                                     T2 two)
Creates a new instance of the pair encapsulating the supplied values.

Type Parameters:
T1 - the type of the first element.
T2 - the type of the second element.
Parameters:
one - the first value
two - the second value
Returns:
the new instance

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


Copyright © 2010 The Apache Software Foundation