Interface TextCollator
-
- All Superinterfaces:
Comparator<String>
- All Known Implementing Classes:
TextCollatorRegistryJRE.TextCollatorJRE
@API(EXPERIMENTAL) public interface TextCollator extends Comparator<String>
An interface for locale-sensitive text comparison and sorting. A text collator is specified with a locale name and a strength.- See Also:
TextCollatorRegistry
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TextCollator.Strength
Standard strength values.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
compare(String str1, String str2)
Compare the two strings according to the this collator's collation rules.ByteString
getKey(String str)
Get a representation of a string suitable for storing in an index for this collation.-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
compare
int compare(@Nonnull String str1, @Nonnull String str2)
Compare the two strings according to the this collator's collation rules.- Specified by:
compare
in interfaceComparator<String>
- Parameters:
str1
- the first stringstr2
- the second string- Returns:
- an integer equal to zero if the two strings are equivalent, less than zero if the first string should sort before the second, or greater than zero if the first string should sort after the second.
-
getKey
@Nonnull ByteString getKey(@Nonnull String str)
Get a representation of a string suitable for storing in an index for this collation. The unsigned byte comparison of the result byte array will match this collator's ordering.- Parameters:
str
- the string to index- Returns:
- a byte string for storing in an index
-
-