voldemort.utils
Class Pair<F,S>

java.lang.Object
  extended by voldemort.utils.Pair<F,S>
All Implemented Interfaces:
com.google.common.base.Function<F,S>, java.io.Serializable

public final class Pair<F,S>
extends java.lang.Object
implements java.io.Serializable, com.google.common.base.Function<F,S>

Represents a pair of items.

See Also:
Serialized Form

Constructor Summary
Pair(F first, S second)
          Use the static factory method create(Object, Object) instead of this where possible.
 
Method Summary
 S apply(F from)
           
static
<F,S> Pair<F,S>
create(F first, S second)
          Static factory method that, unlike the constructor, performs generic inference saving some typing.
 boolean equals(java.lang.Object obj)
           
 F getFirst()
           
 S getSecond()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(F first,
            S second)
Use the static factory method create(Object, Object) instead of this where possible.

Parameters:
first -
second -
Method Detail

create

public static final <F,S> Pair<F,S> create(F first,
                                           S second)
Static factory method that, unlike the constructor, performs generic inference saving some typing. Use in the following way (for a pair of Strings):

Pair pair = Pair.create("first", "second");

Type Parameters:
F - The type of the first thing.
S - The type of the second thing
Parameters:
first - The first thing
second - The second thing
Returns:
The pair (first,second)

apply

public S apply(F from)
Specified by:
apply in interface com.google.common.base.Function<F,S>

getFirst

public final F getFirst()

getSecond

public final S getSecond()

hashCode

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

equals

public final boolean equals(java.lang.Object obj)
Specified by:
equals in interface com.google.common.base.Function<F,S>
Overrides:
equals in class java.lang.Object

toString

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


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu