2.17.2: 2011-06-17

net.sf.basedb.util
Class StringLengthComparator

java.lang.Object
  extended by net.sf.basedb.util.StringLengthComparator
All Implemented Interfaces:
Comparator<String>

public class StringLengthComparator
extends Object
implements Comparator<String>

A comparator implementation for strings that sorts them according to their length. Shortest strings are sorted first. Strings of equal length are sorted in their natural order.

Since:
2.16.2
Author:
Nicklas
Last modified
$Date: 2011-02-18 13:23:23 +0100 (Fri, 18 Feb 2011) $

Constructor Summary
StringLengthComparator()
          Create a new string length comparator instance.
 
Method Summary
 int compare(String o1, String o2)
           
 
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

StringLengthComparator

public StringLengthComparator()
Create a new string length comparator instance.

Method Detail

compare

public int compare(String o1,
                   String o2)
Specified by:
compare in interface Comparator<String>

2.17.2: 2011-06-17