public final class Pair<T1,T2> extends Object implements Serializable
A pair of values.
Modifier and Type | Field and Description |
---|---|
T1 |
value1
The first value.
|
T2 |
value2
The second value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
T1 |
getFirst()
Returns the first value in a pair.
|
T2 |
getSecond()
Returns the second value in a pair.
|
int |
hashCode() |
static <T1,T2> Pair<T1,T2> |
of(T1 first,
T2 second)
Constructs a new pair of values.
|
String |
toString() |
public final T1 value1
The first value.
public final T2 value2
The second value.
public static <T1,T2> Pair<T1,T2> of(T1 first, T2 second)
Constructs a new pair of values.
first
- the first valuesecond
- the second valueT1
- the type of the first valueT2
- the type of the second valuepublic T1 getFirst()
Returns the first value in a pair.
public T2 getSecond()
Returns the second value in a pair.
Copyright © 2022 The Apache Software Foundation. All rights reserved.