Class UUIDTools.UUIDComparator

    • Constructor Detail

      • UUIDComparator

        protected UUIDComparator()
        Creates a new UUID comparator comparing UUIDs unsigned, that is a leading 7 is less than a leading 8. Signed it would be vice versa since 8 is negative.
    • Method Detail

      • compareUnsigned

        protected int compareUnsigned​(long l1,
                                      long l2)
        Compares the designated longs unsigned, that is all negative longs will be greater than all positive longs and negative longs will be reverse ordered, that is numerical less will be more. This allows for a nice ordering of the string representations of UUIDs.
        Parameters:
        l1 - The first long to compare.
        l2 - The second long to compare.
        Returns:
        -1 if the first long is less than the second, 0 if both are equal and 1 if the first long is greater than the second, all treated unsigned.