A - the type of the first object in the pairB - the type of the second object in the pairpublic class Pair<A,B> extends Object
Pair class represents an immutable pair of objects
of heterogeneous type. This class is useful as a return type for
functions computing more than one object.
Identity conditions are that the elements are the same.
| Constructor and Description |
|---|
Pair(A a,
B b)
Construct a pair consisting of the two specified elements.
|
| Modifier and Type | Method and Description |
|---|---|
A |
a()
Return the first value of the pair.
|
B |
b()
Return the second value of the pair.
|
boolean |
equals(Object that)
Returns
true if the specified object
is a pair that has objects equal to this pair's. |
int |
hashCode()
Returns the hash code of the pair.
|
String |
toString()
Returns a string representation of this pair, including
the results of converting each of its components to a string.
|
public A a()
public B b()
public String toString()
public boolean equals(Object that)
true if the specified object
is a pair that has objects equal to this pair's.
Warning: The generic type specifications of the objects being compared do not need to match as long as the elements match.
Copyright © 2019 Alias-i, Inc.. All rights reserved.