Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.comparators
Class ToStringComparator

java.lang.Object
  extended by com.citra.comparators.ToStringComparator
All Implemented Interfaces:
Serializable, Comparator

public class ToStringComparator
extends Object
implements Comparator, Serializable

This class is a comparator for comparing objects according to their toString() values. It assumes that the objects being compared are not null.

See Also:
Serialized Form

Constructor Summary
ToStringComparator()
          Creates a ToStringComparator.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares its two arguments for order as defined by compare of the Comparator interface.
 
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

ToStringComparator

public ToStringComparator()
Creates a ToStringComparator.

Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares its two arguments for order as defined by compare of the Comparator interface. o1 and o2 must be not null, otherwise a NullPointerException will be thrown.

Specified by:
compare in interface Comparator
Parameters:
o1 - the first object to be compared
o2 - the second object to be compared
Returns:
a negative integer, zero, or a positive integer as o1 is less than, equal to, or greater than o2

Copyright © 2011 Citra Technologies. All Rights Reserved.