moj.util
Class ReverseEntryValueComparator
java.lang.Object
moj.util.ReverseEntryValueComparator
- All Implemented Interfaces:
- java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Float>>
public class ReverseEntryValueComparator
- extends java.lang.Object
- implements java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Float>>
Comparator that compares values. Note that it compares the keys as well as
the values. This is necessary to be consistent with Map.Entry.equals() and
to ensure that our entrySet behaves like a Set.
Method Summary |
int |
compare(java.util.Map.Entry<java.lang.String,java.lang.Float> e1,
java.util.Map.Entry<java.lang.String,java.lang.Float> e2)
Compares values in reverse order. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
ReverseEntryValueComparator
public ReverseEntryValueComparator()
compare
public int compare(java.util.Map.Entry<java.lang.String,java.lang.Float> e1,
java.util.Map.Entry<java.lang.String,java.lang.Float> e2)
- Compares values in reverse order. Note that it compares the keys as well as the values.
This is necessary to be consistent with Map.Entry.equals() and to
ensure that our entrySet behaves like a Set.
- Specified by:
compare
in interface java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Float>>
- Parameters:
e1
- Map.Entry<String,Float>
that is to be compared to e2
.e2
- Map.Entry<String,Float>
that is to be compared to e1
.
- Returns:
- the difference between
e1
and e2
.