Hello David,

On 27/04/26 7:21 am, David Alayachew wrote:
Hello @core-libs-dev <[email protected]>,

Today was the first time I used the UUID library past UUID.randomUUID() and
UUID.fromString(String).

I saw that UUID.ofEpochMillis(long timestamp) has the ability to create a
UUID version 7 UUID -- a time-based UUID! Great, I also see that there is a
UUID.timestamp() method, can I use that to extract the timestamp from it?

Sadly, no. The UUID.timestamp() method is reserved for UUID version 1,
whereas UUID.ofEpochMillis(long timestamp) generates UUID version 7.

Ok, fair, the documentation is clear. But why can't we just add that
functionality to UUID.timestamp()? It's not that complex.

This and other similar questions were discussed during the review of https://bugs.openjdk.org/browse/JDK-8334015. The PR here https://github.com/openjdk/jdk/pull/25303 (or its corresponding mailing list thread in core-libs-dev) has all those discussions. For this specific question, the discussion is here https://mail.openjdk.org/pipermail/core-libs-dev/2025-September/152621.html

-Jaikiran



Alternatively, could we add a method that returns something more strongly
typed, like UUID.extractInstant()? Then, we can leave this method alone,
and just make a new one.

Thank you for your time and consideration.
David Alayachew

Reply via email to