- Type Parameters:
A - the type of the first object
B - the type of the second object
public final class Pair<A,B>
extends Object
An immutable class for pairs of objects.
- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
-
Constructor Summary
Constructors
| Constructor |
Description |
Pair(A first,
B second) |
Creates a pair with the given values.
|
-
Method Summary
| Modifier and Type |
Method |
Description |
boolean |
equals(Object o) |
int |
hashCode() |
static <A,
B> Pair<A,B> |
of(A first,
B second) |
A convenience method for creating pairs without specifying the types.
|
-
-
Constructor Details
-
public Pair(
A first,
B second)
Creates a pair with the given values.
- Parameters:
first - the first value
second - the second value
-
Method Details
-
-
-
public static <A,
B> Pair<A,B> of(
A first,
B second)
A convenience method for creating pairs without specifying the types.
- Parameters:
first - the first value
second - the second value
- Returns:
- the pair containing
first and (@code second}