voldemort.utils
Class Pair<F,S>
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Pair
public Pair(F first,
S second)
- Use the static factory method
create(Object, Object)
instead of
this where possible.
- Parameters:
first
- second
-
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 thingsecond
- 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>
- Parameters:
from
-
- Returns:
this.second
if from == this.first
even if
from
and this.first
are both null
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