structure
Class NaturalComparator
java.lang.Object
structure.NaturalComparator
- All Implemented Interfaces:
- Comparator
public class NaturalComparator
- extends Object
- implements Comparator
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. |
NaturalComparator
public NaturalComparator()
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 compareb
- 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