com.esri.aims.mtier.model.util
Class ToStringComparator

java.lang.Object
  extended by com.esri.aims.mtier.model.util.ToStringComparator
All Implemented Interfaces:
Comparator

public class ToStringComparator
extends Object
implements Comparator

Compares two objects using their toString() methods.

See Also:
Collections

Field Summary
static ToStringComparator comparator
          The static instance of this object can be used as the comparator for most occasions.
 
Constructor Summary
ToStringComparator()
           
 
Method Summary
 int compare(Object object1, Object object2)
          Compares two objects by their toString() method and returns an integer N where N<0, N=0, or N>0 if the value of object1.toString().toUpper() is less than, equal to, or greater than object1.toString().toUpper().
 boolean equals(Object object)
          Uses default implementation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparator

public static final ToStringComparator comparator
The static instance of this object can be used as the comparator for most occasions. If you are going to use this object heavily, create another instance.

Constructor Detail

ToStringComparator

public ToStringComparator()
Method Detail

compare

public int compare(Object object1,
                   Object object2)
Compares two objects by their toString() method and returns an integer N where N<0, N=0, or N>0 if the value of object1.toString().toUpper() is less than, equal to, or greater than object1.toString().toUpper().

Specified by:
compare in interface Comparator
Parameters:
object1 - The first object to be compared.
object2 - The second object to be compared.
Returns:
(see comments)

equals

public boolean equals(Object object)
Uses default implementation.

Specified by:
equals in interface Comparator
Overrides:
equals in class Object