com.fasterxml.uuid/java-uuid-generator
com.fasterxml.uuid
cowtowncoder/java-uuid-generator
com.fasterxml.uuid
has methods to generate, and customize the generation of, UUIDs.
Most of the time, folks use UUID.randomUUID()
to get their universally unique identifiers. That makes a UUIDv4.
But the world of UUIDs is more varied than that and there are different kinds of UUIDs that you might want to use.
This includes UUIDv6 and UUIDv7, which aren't referenced in the above link.
Fun fact though, this library predates the addition of UUID.randomUUID()
to the standard library.
import com.fasterxml.uuid.Generators;
void main() {
= Generators
var uuidv7 .timeBasedEpochGenerator().generate(); // Version 7
System.out.println(uuidv7);
= Generators
var uuidv5 .nameBasedGenerator()
.generate("string to hash");
System.out.println(uuidv5);
}