Package de.aristaflow.adept2.util
Class UUIDTools.UUIDComparator
java.lang.Object
de.aristaflow.adept2.util.UUIDTools.UUIDComparator
- All Implemented Interfaces:
SerialisableComparator<UUID>,Serializable,Comparator<UUID>
- Enclosing class:
- UUIDTools
protected static class UUIDTools.UUIDComparator
extends Object
implements SerialisableComparator<UUID>
A 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.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new UUID comparator comparing UUIDs unsigned, that is a leading 7 is less than a leading 8. -
Method Summary
Modifier and TypeMethodDescriptionintprotected intcompareUnsigned(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
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 Details
-
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.
-
compare
- Specified by:
comparein interfaceComparator<UUID>
-