An implementation of Universal Unique Identifier (UUID). See

The current impelementation supports only a JDK backend due to dependencies upon MessageDigest, to produce random bytes, and to implement MD5/SHA-1 hashing, respectively.

According to the standard, the following components make up a UUID:

  • timeLow (8 digits)
  • timeMid (4 digits)
  • timeHiVersion (4 digits)
  • clockSeqHiVariant (2 digits)
  • clockSeqLow (2 digits)
  • node (12 digits)

For example, for the following UUID: 5561de0e-64ad-4d9b-94f2-46926fc44121:

  • timeLow = 5561de0e
  • timeMid = 64ad
  • timeHiVersion = 4d9b
  • clockSeqHiVariant = 94
  • clockSeqLow = f2
  • node = 46926fc44121

Since the above UUID was generated randomly, its version is 4, and is the first digit of the timeHiVersion.

The variant is 2. Despite any variant with a leading bit of 1 being supported, with all variants supported for either backward of future compatbility, only variant 2 is in actual use.

Currently, only versions 3 (MD5 sum), 4 (randomly generated), and 5 (SHA1) are supported.

  • UUID
    • Basic
      • Identifiable
      • Object
        • Anything

no subtypes hierarchy

UUIDshared UUID(Integer64 mostSignificantBits, Integer64 leastSignificantBits)

This constructor is not meant to be exposed outside of the module. Clients should invoke one of the top-level functions to obtain a UUID.

bytesshared Byte[] bytes

The Byte Sequence for this UUID

hashshared actual Integer hash

The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:

  • if x==y then x.hash==y.hash.

Therefore, a class which refines equals must also refine hash.

In general, hash values vary between platforms and between executions of the same program.

Note that when executing on a Java Virtual Machine, the 64-bit Integer value returned by an implementation of hash is truncated to a 32-bit integer value by removal of the 32 highest order bits, before returning the value to the caller.

Refines Identifiable.hash ultimately refines Object.hash
stringshared actual String string

Obtain the String representation of this UUID. Example: c7761fd5-ee11-46ce-a0cc-ff8f8fb72a23

Refines Object.string
variantshared Integer variant

The UUID variant belonging to this UUID. Only variant 2 is in actual use.

versionshared UuidSupportedVersion version

The UUID version belonging to this UUID. Only versions 3, 4, and 5 are currently supported.

Inherited Attributes
Attributes inherited from: Object
hash, string
equalsshared actual Boolean equals(Object other)

Determine if two values are equal. Implementations should respect the constraints that:

  • if x===y then x==y (reflexivity),
  • if x==y then y==x (symmetry),
  • if x==y and y==z then x==z (transitivity).

Furthermore it is recommended that implementations ensure that if x==y then x and y have the same concrete class.

A class which explicitly refines equals() is said to support value equality, and the equality operator == is considered much more meaningful for such classes than for a class which simply inherits the default implementation of identity equality from Identifiable.

Note that an implementation of equals() that always returns false does satisfy the constraints given above. Therefore, in very rare cases where there is no reasonable definition of value equality for a class, for example, function references (Callable), it is acceptable for equals() to be defined to return false for every argument.

Refines Identifiable.equals ultimately refines Object.equals
Inherited Methods
Methods inherited from: Object