net.spy.util
Class ToStringComparator

java.lang.Object
  extended by net.spy.util.ToStringComparator
All Implemented Interfaces:
java.util.Comparator<java.lang.Object>

public class ToStringComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>

A Comparator that compares the String representation of objects.


Field Summary
static int NULLS_FIRST
          For sort order with nulls first.
static int NULLS_LAST
          For sort order with nulls last.
 
Constructor Summary
ToStringComparator()
          Get an instance of ToStringComparator sorting nulls last.
ToStringComparator(int no)
          Get a ToStringComparator with the provided null order.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Perform the comparison.
 
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
 

Field Detail

NULLS_FIRST

public static final int NULLS_FIRST
For sort order with nulls first.

See Also:
Constant Field Values

NULLS_LAST

public static final int NULLS_LAST
For sort order with nulls last.

See Also:
Constant Field Values
Constructor Detail

ToStringComparator

public ToStringComparator()
Get an instance of ToStringComparator sorting nulls last.


ToStringComparator

public ToStringComparator(int no)
Get a ToStringComparator with the provided null order.

Parameters:
no - how nulls are ordered
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Perform the comparison.

Specified by:
compare in interface java.util.Comparator<java.lang.Object>


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.