public class SimpleCollation extends java.lang.Object implements StringCollator
Constructor and Description |
---|
SimpleCollation(java.util.Comparator collation)
Create a SimpleCollation
|
Modifier and Type | Method and Description |
---|---|
boolean |
comparesEqual(java.lang.String s1,
java.lang.String s2)
Compare two strings for equality.
|
int |
compareStrings(java.lang.String o1,
java.lang.String o2)
Compares its two arguments for order.
|
java.util.Comparator |
getCollation()
Get the underlying comparator
|
java.lang.Object |
getCollationKey(java.lang.String s)
Get a collation key for two Strings.
|
void |
setCollation(java.util.Comparator collation)
Set the underlying comparator
|
public SimpleCollation(java.util.Comparator collation)
collation
- the Comparator that does the actual string comparisonpublic int compareStrings(java.lang.String o1, java.lang.String o2)
compareStrings
in interface StringCollator
o1
- the first object to be compared.o2
- the second object to be compared.java.lang.ClassCastException
- if the arguments' types prevent them from
being compared by this Comparator.public boolean comparesEqual(java.lang.String s1, java.lang.String s2)
comparesEqual
in interface StringCollator
s1
- the first strings2
- the second stringpublic java.util.Comparator getCollation()
public void setCollation(java.util.Comparator collation)
collation
- the underlying comparatorpublic java.lang.Object getCollationKey(java.lang.String s)
getCollationKey
in interface StringCollator
s
- the string whose collation key is required