Package libcore.icu
Class CollationKeyICU
java.lang.Object
java.text.CollationKey
libcore.icu.CollationKeyICU
- All Implemented Interfaces:
Comparable<CollationKey>
public final class CollationKeyICU extends CollationKey
A concrete implementation of the abstract java.text.CollationKey.
-
Method Summary
Modifier and Type Method Description intcompareTo(CollationKey other)Compares this collation key to the given collation key.booleanequals(Object object)Compares this instance with the specified object and indicates if they are equal.inthashCode()Creates a hash code for this CollationKey.byte[]toByteArray()Returns this collation key as a byte array.Methods inherited from class java.text.CollationKey
getSourceString
-
Method Details
-
compareTo
Description copied from class:CollationKeyCompares this collation key to the given collation key.- Specified by:
compareToin interfaceComparable<CollationKey>- Specified by:
compareToin classCollationKey- Parameters:
other- the other collation key.- Returns:
- a negative value if this key is less than
value, 0 if they are equal, and a positive value if this key is greater.
-
equals
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.The default implementation returns
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
object- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Creates a hash code for this CollationKey. Compute the hash by iterating sparsely over about 32 (up to 63) bytes spaced evenly through the string. For each byte, multiply the previous hash value by a prime number and add the new byte in, like a linear congruential random number generator, producing a pseudo-random deterministic value well distributed over the output range.- Overrides:
hashCodein classObject- Returns:
- hash value of collation key. Hash value is never 0.
- See Also:
Object.equals(java.lang.Object)
-
toByteArray
public byte[] toByteArray()Description copied from class:CollationKeyReturns this collation key as a byte array.- Specified by:
toByteArrayin classCollationKey- Returns:
- an array of bytes.
-