net.rim.device.api.util
Class StringComparator

java.lang.Object
  |
  +--net.rim.device.api.util.StringComparator
All Implemented Interfaces:
Comparator

public class StringComparator
extends Object
implements Comparator

A basic Comparator implementation to compare String instances either case-sensitively or case-insensitively.

Since:
JDE 4.5.0

Method Summary
 int compare(Object o1, Object o2)
          Compares the two strings lexicographically using the desired case-sensitivity.
static StringComparator getInstance(boolean ignoreCase)
          Returns an instance of a StringComparator with the desired case sensitivity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.rim.device.api.util.Comparator
equals
 

Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares the two strings lexicographically using the desired case-sensitivity.
Parameters:
o1 - First string to compare
o2 - Second string to compare
Returns:
0 if the two strings are equal, less than zero if o1 is less than o2, greater than zero if o1 is greater than o2.
Throws:
NullPointerException - if either o1 or o2 is null
ClassCastException - if the run-time type of either o1 or o2 is not String
Since:
JDE 4.5.0

getInstance

public static final StringComparator getInstance(boolean ignoreCase)
Returns an instance of a StringComparator with the desired case sensitivity.
Parameters:
ignoreCase - Whether or not the StringComparator should be case-insensitive.
Returns:
The desired StringComparator instance.
Since:
JDE 4.5.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.