de.lmu.ifi.dbs.elki.utilities.pairs
Class Pair<FIRST,SECOND>
java.lang.Object
de.lmu.ifi.dbs.elki.utilities.pairs.Pair<FIRST,SECOND>
- Type Parameters:
FIRST - first typeSECOND - second type
- Direct Known Subclasses:
- CPair, DefaultHeapNode, FCPair, MinMax, SCPair
public class Pair<FIRST,SECOND>
- extends Object
Generic SimplePair class.
Does not implement any "special" interfaces such as Comparable, use
CPair if you want comparable pairs.
- Author:
- Erich Schubert
first
public FIRST first
- First value in pair
second
public SECOND second
- Second value in pair
Pair
public Pair(FIRST first,
SECOND second)
- Initialize pair
- Parameters:
first - first parametersecond - second parameter
toString
public String toString()
- Canonical toString operator
- Overrides:
toString in class Object
getFirst
public final FIRST getFirst()
- Getter for first
- Returns:
- first element in pair
setFirst
public final void setFirst(FIRST first)
- Setter for first
- Parameters:
first - new value for first element
getSecond
public final SECOND getSecond()
- Getter for second element in pair
- Returns:
- second element in pair
setSecond
public final void setSecond(SECOND second)
- Setter for second
- Parameters:
second - new value for second element
newPairArray
public static final <F,S> Pair<F,S>[] newPairArray(int size)
- Create a new array of the given size (for generics)
- Type Parameters:
F - First classS - Second class- Parameters:
size - array size
- Returns:
- empty array of the new type.
equals
public boolean equals(Object obj)
- Simple equals statement.
This Pair equals another Object if they are identical or
if the other Object is also a Pair and the
first and second element
of this Pair equal the first and second element, respectively, of the other Pair.
- Overrides:
equals in class Object
- Parameters:
obj - Object to compare to
hashCode
public final int hashCode()
- Canonical hash function, mixing the two hash values.
- Overrides:
hashCode in class Object