|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tkuhn.util.DefaultComparator
public class DefaultComparator
This is a Comparator
that compares any pair of
Object
s.
First of all this Comparator
defines null
as less
than anything else.
Two Boolean
s: false is less than true
Two Number
s are compared using their double value.
Two Comparable
s: If one object is of the same or an extending
class as the other the compareTo(Object obj)
method of the
extending class is used to compare the two objects. E.g. if
o1.getClass.isInstance(o2)
holds, than
o2.compareTo()
will be used.
In all other cases simply the String values of the two objects will be
compared.
Constructor Summary | |
---|---|
DefaultComparator()
Creates a new instance of DefaultComparator |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Implementation of compare(obj,obj) in the interface
java.util.Comparator . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public DefaultComparator()
Method Detail |
---|
public int compare(java.lang.Object o1, java.lang.Object o2)
compare(obj,obj)
in the interface
java.util.Comparator
.
compare
in interface java.util.Comparator<java.lang.Object>
o1
- row one to be comparedo2
- row two to be compared
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |