Class ToStringComparator<T>

java.lang.Object
net.sf.basedb.util.ToStringComparator<T>
All Implemented Interfaces:
Serializable, Comparator<T>

public class ToStringComparator<T> extends Object implements Comparator<T>, Serializable
An implementation of the Comparator interface which uses the result of the toString method to compare the objects. Ie. by using this comparator objects are sorted according to the toString() values.

Note: this comparator may impose orderings that are inconsistent with equals.

Version:
2.0
Author:
Nicklas
See Also:
Last modified
$Date: 2010-08-13 10:50:27 +0200 (fr, 13 aug 2010) $
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • descending

      private final boolean descending
  • Constructor Details

    • ToStringComparator

      public ToStringComparator(boolean descending)
      Create a new comparator.
      Parameters:
      descending - TRUE to sort objects in descending order (z--a), FALSE to sort the objects in ascending order (a--z)
  • Method Details