@InterfaceAudience.Public public class Pair<T1,T2> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected T1 |
first |
protected T2 |
second |
private static long |
serialVersionUID |
Constructor and Description |
---|
Pair()
Default constructor.
|
Pair(T1 a,
T2 b)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
private static boolean |
equals(Object x,
Object y) |
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> |
newPair(T1 a,
T2 b)
Constructs a new pair, inferring the type via the passed arguments
|
void |
setFirst(T1 a)
Replace the first element of the pair.
|
void |
setSecond(T2 b)
Replace the second element of the pair.
|
String |
toString() |
private static final long serialVersionUID
public Pair()
public static <T1,T2> Pair<T1,T2> newPair(T1 a, T2 b)
T1
- type for firstT2
- type for seconda
- first elementb
- second elementpublic void setSecond(T2 b)
b
- operandCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.