FIRST
- first typeSECOND
- second typepublic static class PairUtil.CompareSwapped<FIRST,SECOND> extends Object implements Comparator<Pair<? extends FIRST,? extends SECOND>>
Modifier and Type | Field and Description |
---|---|
private Comparator<? super FIRST> |
fcomparator
A comparator for type FIRST.
|
private Comparator<? super SECOND> |
scomparator
A comparator for type FIRST.
|
Constructor and Description |
---|
PairUtil.CompareSwapped(Comparator<? super FIRST> fcomparator,
Comparator<? super SECOND> scomparator)
Provides a comparator for an
Pair based on the given Comparator
for type P . |
Modifier and Type | Method and Description |
---|---|
int |
compare(Pair<? extends FIRST,? extends SECOND> o1,
Pair<? extends FIRST,? extends SECOND> o2)
Two Objects of type
Pair are compared based on the comparison of
their property using the given comparators scomparator , then
fcomparator . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
private Comparator<? super FIRST> fcomparator
private Comparator<? super SECOND> scomparator
public PairUtil.CompareSwapped(Comparator<? super FIRST> fcomparator, Comparator<? super SECOND> scomparator)
Pair
based on the given Comparator
for type P
.fcomparator
- Comparator for the first componentscomparator
- Comparator for the second componentpublic int compare(Pair<? extends FIRST,? extends SECOND> o1, Pair<? extends FIRST,? extends SECOND> o2)
Pair
are compared based on the comparison of
their property using the given comparators scomparator
, then
fcomparator
.compare
in interface Comparator<Pair<? extends FIRST,? extends SECOND>>
o1
- First objecto2
- Second objectComparator.compare(T, T)