public class UUIDComparator extends Object implements Comparator<UUID>
UUID
comparator is not very useful, since
it just does blind byte-by-byte comparison which does not work well
for time+location - based UUIDs. Additionally, it also uses signed
comparisons for longs which can lead to unexpected behavior
This comparator does implement proper lexical ordering: starting with
type (different types are collated
separately), followed by time and location (for time/location based),
and simple lexical (byte-by-byte) ordering for name/hash and random
versions.Constructor and Description |
---|
UUIDComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(UUID u1,
UUID u2) |
protected static int |
compareUInts(int i1,
int i2) |
protected static int |
compareULongs(long l1,
long l2) |
static int |
staticCompare(UUID u1,
UUID u2)
Static helper method that can be used instead of instantiating comparator
(used by unit tests, can be used by code too)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public int compare(UUID u1, UUID u2)
compare
in interface Comparator<UUID>
public static int staticCompare(UUID u1, UUID u2)
protected static final int compareULongs(long l1, long l2)
protected static final int compareUInts(int i1, int i2)
Copyright © 2023 FasterXML.com. All rights reserved.