scuffed-code/tools/unicodetools/com/ibm/text/utility/LengthFirstComparator.java
Mark Davis 4c3e3b8dff Forgot copyrights
X-SVN-Rev: 5642
2001-08-31 00:20:40 +00:00

26 lines
882 B
Java

/**
*******************************************************************************
* Copyright (C) 1996-2001, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/unicodetools/com/ibm/text/utility/LengthFirstComparator.java,v $
* $Date: 2001/08/31 00:19:16 $
* $Revision: 1.2 $
*
*******************************************************************************
*/
package com.ibm.text.utility;
import java.util.*;
public final class LengthFirstComparator implements Comparator {
public int compare(Object a, Object b) {
String as = (String) a;
String bs = (String) b;
if (as.length() < bs.length()) return -1;
if (as.length() > bs.length()) return 1;
return as.compareTo(bs);
}
}