public class Uuid extends Object implements Comparable<Uuid>
Modifier and Type | Field and Description |
---|---|
static Uuid |
METADATA_TOPIC_ID
A UUID for the metadata topic in KRaft mode.
|
static Uuid |
ONE_UUID
A reserved UUID.
|
static Set<Uuid> |
RESERVED
The set of reserved UUIDs that will never be returned by the randomUuid method.
|
static Uuid |
ZERO_UUID
A UUID that represents a null or empty UUID.
|
Constructor and Description |
---|
Uuid(long mostSigBits,
long leastSigBits)
Constructs a 128-bit type 4 UUID where the first long represents the most significant 64 bits
and the second long represents the least significant 64 bits.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Uuid other) |
boolean |
equals(Object obj)
Returns true iff obj is another Uuid represented by the same two long values.
|
static Uuid |
fromString(String str)
Creates a UUID based on a base64 string encoding used in the toString() method.
|
long |
getLeastSignificantBits()
Returns the least significant bits of the UUID's 128 value.
|
long |
getMostSignificantBits()
Returns the most significant bits of the UUID's 128 value.
|
int |
hashCode()
Returns a hash code for this UUID
|
static Uuid |
randomUuid()
Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
|
static Uuid[] |
toArray(List<Uuid> list)
Convert a list of Uuid to an array of Uuid.
|
static List<Uuid> |
toList(Uuid[] array)
Convert an array of Uuids to a list of Uuid.
|
String |
toString()
Returns a base64 string encoding of the UUID.
|
public static final Uuid ONE_UUID
public static final Uuid METADATA_TOPIC_ID
public static final Uuid ZERO_UUID
public Uuid(long mostSigBits, long leastSigBits)
public static Uuid randomUuid()
public long getMostSignificantBits()
public long getLeastSignificantBits()
public boolean equals(Object obj)
public int hashCode()
public String toString()
public static Uuid fromString(String str)
public int compareTo(Uuid other)
compareTo
in interface Comparable<Uuid>
public static Uuid[] toArray(List<Uuid> list)
list
- The input list