public class StringComparator
extends java.lang.Object
implements java.util.Comparator
| Modifier and Type | Field and Description |
|---|---|
private java.text.Collator |
collator_ |
private boolean |
isAscending_ |
private java.util.Locale |
locale_ |
| Constructor and Description |
|---|
StringComparator(java.util.Locale locale)
Create a locale specific comparator.
|
StringComparator(java.util.Locale locale,
int collatorStrength,
boolean isAscending)
Create a locale specific comparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(java.lang.Object object1,
java.lang.Object object2)
Compare the two strings.
|
private final java.util.Locale locale_
private final java.text.Collator collator_
private final boolean isAscending_
public StringComparator(java.util.Locale locale,
int collatorStrength,
boolean isAscending)
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.public StringComparator(java.util.Locale locale)
locale - The locale to be used when determining sorting order.
If locale is null then a binary comparison is performed.public int compare(java.lang.Object object1,
java.lang.Object object2)
compare in interface java.util.Comparatorobject1 - The first string.object2 - The second string.