public class Pair<T,S> extends Object implements Comparable<Pair<T,S>>
Modifier and Type | Field and Description |
---|---|
private T |
firstElement |
private S |
secondElement |
Constructor and Description |
---|
Pair(T firstElement,
S secondElement)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Pair<T,S> pair)
Compares this pair to the specified pair
|
boolean |
equals(Object obj)
Checks if the elements in this pair are equal to the elements of the specified pair
|
T |
getFirstElement()
Get the first element in the pair
|
S |
getSecondElement()
Get the second element in the pair
|
int |
hashCode()
The hash code for the pair
|
public T getFirstElement()
public S getSecondElement()
public int compareTo(Pair<T,S> pair)
compareTo
in interface Comparable<Pair<T,S>>
pair
- The pair to compare toCopyright © 2019. All rights reserved.