A DESCRIPTION OF THE PROBLEM :
As reported here https://bugs.openjdk.org/browse/JDK-7025832 the compareTo in UUID does not conform to the UUID standard.
Is there any way that this can be addressed?
Tried to implement the comparator, but mostSigBits is private, so it's not possible to write client code like:
```
int mostSigBits = Long.compareUnsigned(this.mostSigBits, val.mostSigBits);
return mostSigBits != 0 ? mostSigBits : Long.compareUnsigned(this.leastSigBits, val.leastSigBits);
```
The only option is to serialize to String and compare, which is obviously not good from a performance point of view.
Would it be possible for the UUID to expose a standard compliant method, even if it is not the comparator interface? Or a JDK flag that would allow using the right comparator?
As reported here https://bugs.openjdk.org/browse/JDK-7025832 the compareTo in UUID does not conform to the UUID standard.
Is there any way that this can be addressed?
Tried to implement the comparator, but mostSigBits is private, so it's not possible to write client code like:
```
int mostSigBits = Long.compareUnsigned(this.mostSigBits, val.mostSigBits);
return mostSigBits != 0 ? mostSigBits : Long.compareUnsigned(this.leastSigBits, val.leastSigBits);
```
The only option is to serialize to String and compare, which is obviously not good from a performance point of view.
Would it be possible for the UUID to expose a standard compliant method, even if it is not the comparator interface? Or a JDK flag that would allow using the right comparator?
- relates to
-
JDK-7025832 java.lang.UUID compareTo() does not do an unsigned compare
-
- Closed
-