Package com.linkedin.alpini.base.misc
Class Pair<F,S>
java.lang.Object
com.linkedin.alpini.base.misc.Pair<F,S>
- Direct Known Subclasses:
ImmutableMapEntry
A simple container for a pair of (2) values.
Adapted from Jemiah's code in com.linkedin.util.
This class lets us hold a pair of elements
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P extends Pair<F,
S>, F, S>
P[]array
(P... array) Return an array of Pair.boolean
Test for equality between this andobj
.final F
getFirst()
Return the first value.final S
Return the second value.int
hashCode()
Compute a hash value for the Pair.static <F,
S> Pair<F, S> make
(F first, S second) Make a Pair.toString()
Return a string representation of the Pair.
-
Constructor Details
-
Pair
Constructor for a pair. A simpler alternative is to usemake(Object, Object)
instead.- Parameters:
first
- First value.second
- Second value.
-
-
Method Details
-
make
Make a Pair.- Type Parameters:
F
- Type of first argument, usually inferred automatically.S
- Type of seconnd argument, usually inferred automatically.- Parameters:
first
- First value.second
- Second value.- Returns:
- newly constructed Pair instance.
-
array
Return an array of Pair.- Type Parameters:
F
- Type of first argument, usually inferred automatically.S
- Type of first argument, usually inferred automatically.- Parameters:
array
- Comma seperated list of Pair objects.- Returns:
- array of Pair objects.
-
getFirst
Return the first value.- Returns:
- first value.
-
getSecond
Return the second value.- Returns:
- second value.
-
equals
Test for equality between this andobj
. -
hashCode
public int hashCode()Compute a hash value for the Pair. -
toString
Return a string representation of the Pair.
-