moj.util
Class EntryValueComparator
java.lang.Object
moj.util.EntryValueComparator
- All Implemented Interfaces:
- java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Double>>
public class EntryValueComparator
- extends java.lang.Object
- implements java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Double>>
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.Double> e1,
java.util.Map.Entry<java.lang.String,java.lang.Double> e2)
Compares values. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
EntryValueComparator
public EntryValueComparator()
compare
public int compare(java.util.Map.Entry<java.lang.String,java.lang.Double> e1,
java.util.Map.Entry<java.lang.String,java.lang.Double> e2)
- 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.
- Specified by:
compare
in interface java.util.Comparator<java.util.Map.Entry<java.lang.String,java.lang.Double>>
- 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
.