com.gargoylesoftware.base.collections
public class StringComparator extends Object implements Comparator
Version: $Revision: 1.3 $
Field Summary | |
---|---|
Collator | collator_ |
boolean | isAscending_ |
Locale | locale_ |
Constructor Summary | |
---|---|
StringComparator(Locale locale, int collatorStrength, boolean isAscending)
Create a locale specific comparator.
| |
StringComparator(Locale locale)
Create a locale specific comparator.
|
Method Summary | |
---|---|
int | compare(Object object1, Object object2)
Compare the two strings. |
Parameters: locale The locale to be used when determining sorting order. If locale is null then a binary comparison is performed. collatorStrength The strength value to be used by the Collator. If locale is null then this value is ignored. isAscending True if we are sorting in ascending order, false otherwise.
Parameters: locale The locale to be used when determining sorting order. If locale is null then a binary comparison is performed.
Parameters: object1 The first string. object2 The second string.
Returns: a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.