F
- the type of the first object, which must be Serializable
S
- the type of the second object, which must be Serializable
public class Pair<F extends Serializable,S extends Serializable> extends Object implements Serializable
The two objects of the pair must be serializable
and can be of the same
type.
Note that this class is not intended to be used as a general-purpose pair and should only be used when interfacing with the extractor.
Constructor and Description |
---|
Pair(F first,
S second)
Creates a new
Pair object. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Reveals whether an object is equal to this
Pair instance. |
F |
getFirst()
Gets the first object of the pair.
|
S |
getSecond()
Gets the second object of the pair.
|
int |
hashCode()
Returns a hash code of the current
Pair by using the first and second object. |
void |
setFirst(F first)
Sets the first object, which must be of the
F type. |
void |
setSecond(S second)
Sets the first object, which must be of the
S type. |
String |
toString()
Returns a string representation of the current
Pair . |
public void setFirst(F first)
F
type.first
- the new first object of the pairpublic void setSecond(S second)
S
type.second
- the new first object of the pairpublic F getFirst()
public S getSecond()
public String toString()
Pair
.
The string representation will look like this:
{firstObject.toString(), secondObject.toString()}
public boolean equals(Object obj)
Pair
instance.