com.fasterxml.uuid

What is it

com.fasterxml.uuid has methods to generate, and customize the generation of, UUIDs.

Why use it

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.

Getting Started

import com.fasterxml.uuid.Generators;

void main() {
    var uuidv7 = Generators
            .timeBasedEpochGenerator().generate(); // Version 7

    System.out.println(uuidv7);

    var uuidv5 = Generators
            .nameBasedGenerator()
            .generate("string to hash");

    System.out.println(uuidv5);
}

<- Index