moj.util
Class EntryValueComparator

java.lang.Object
  extended by 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.


Constructor Summary
EntryValueComparator()
           
 
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
 

Constructor Detail

EntryValueComparator

public EntryValueComparator()
Method Detail

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.