de.lmu.ifi.dbs.elki.utilities.pairs
Class PairUtil.CompareByFirst<FIRST,SECOND>
java.lang.Object
de.lmu.ifi.dbs.elki.utilities.pairs.PairUtil.CompareByFirst<FIRST,SECOND>
- Type Parameters:
FIRST
- first typeSECOND
- second type
- All Implemented Interfaces:
- Comparator<Pair<? extends FIRST,? extends SECOND>>
- Enclosing class:
- PairUtil
public static class PairUtil.CompareByFirst<FIRST,SECOND>
- extends Object
- implements Comparator<Pair<? extends FIRST,? extends SECOND>>
Compare two SimplePairs based on a comparator for the first component.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
comparator
private Comparator<? super FIRST> comparator
- A comparator for type P.
PairUtil.CompareByFirst
public PairUtil.CompareByFirst(Comparator<? super FIRST> comparator)
- Provides a comparator for an
Pair
based on the given Comparator
for type P
.
- Parameters:
comparator
- a Comparator for type P
to base the
comparison of an Pair
on
compare
public int compare(Pair<? extends FIRST,? extends SECOND> o1,
Pair<? extends FIRST,? extends SECOND> o2)
- To Objects of type
Pair
are compared based on the comparison of
their property using the current PairUtil.comparator()
.
- Specified by:
compare
in interface Comparator<Pair<? extends FIRST,? extends SECOND>>
- Parameters:
o1
- First objecto2
- Second object
- Returns:
- comparison result
- See Also:
Comparator.compare(T, T)