Package libcore.icu

Class CollationKeyICU

  • All Implemented Interfaces:
    Comparable<CollationKey>

    public final class CollationKeyICU
    extends CollationKey
    A concrete implementation of the abstract java.text.CollationKey.
    • Method Detail

      • compareTo

        public int compareTo​(CollationKey other)
        Description copied from class: CollationKey
        Compares this collation key to the given collation key.
        Specified by:
        compareTo in interface Comparable<CollationKey>
        Specified by:
        compareTo in class CollationKey
        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

        public boolean equals​(Object object)
        Description copied from class: Object
        Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must 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 true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

        The general contract for the equals and Object.hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare this instance with.
        Returns:
        true if the specified object is equal to this Object; false otherwise.
        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:
        hashCode in class Object
        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: CollationKey
        Returns this collation key as a byte array.
        Specified by:
        toByteArray in class CollationKey
        Returns:
        an array of bytes.