net.kwfgrid.gwes.util
Class StringLengthComparator
java.lang.Object
net.kwfgrid.gwes.util.StringLengthComparator
- All Implemented Interfaces:
- Comparator
public class StringLengthComparator
- extends Object
- implements Comparator
Compares two Strings by means of its string length.
- Version:
- $Id: StringLengthComparator.java 1433 2010-11-29 18:06:07Z hoheisel $
- Author:
- Andreas Hoheisel
(www.andreas-hoheisel.de)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringLengthComparator
public StringLengthComparator()
compare
public int compare(Object o1,
Object o2)
- Compares its two Strings for order. Returns a negative integer,
zero, or a positive integer as the length of the first String is less than, equal
to, or greater than the second.
Note: this comparator imposes orderings that are inconsistent with equals.
- 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 the
first argument is less than, equal to, or greater than the
second.
- Throws:
ClassCastException - if the arguments' types prevent them from
being compared by this Comparator.
Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.