structure
Class NaturalComparator

java.lang.Object
  extended by structure.NaturalComparator
All Implemented Interfaces:
Comparator

public class NaturalComparator
extends Object
implements Comparator


Constructor Summary
NaturalComparator()
           
 
Method Summary
 int compare(Object a, Object b)
          Compare two values, a and b.
 boolean equals(Object b)
          Returns true if the other object is a NaturalComparator.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalComparator

public NaturalComparator()
Method Detail

compare

public int compare(Object a,
                   Object b)
Compare two values, a and b. Simply calls the default compareTo method for a on b.

Specified by:
compare in interface Comparator
Parameters:
a - object performing the compare
b - the object being compared
Returns:
value <, ==, > 0 if a <, ==, > b using a.compareTo

equals

public boolean equals(Object b)
Returns true if the other object is a NaturalComparator.

Specified by:
equals in interface Comparator
Overrides:
equals in class Object
Parameters:
b - a possible NaturalComparator
Returns:
true if b is a NaturalComparator