public final class UUID
extends Object
UUID represents Universally Unique Identifiers (aka Global UID in Windows
world). UUIDs are usually generated via UUIDGenerator (or in case of 'Null
UUID', 16 zero bytes, via static method getNullUUID()), or received from
external systems.
By default class caches the string presentations of UUIDs so that description
is only created the first time it's needed. For memory stingy applications
this caching can be turned off (note though that if uuid.toString() is never
called, desc is never calculated so only loss is the space allocated for the
desc pointer... which can of course be commented out to save memory).
Similarly, hash code is calculated when it's needed for the first time, and
from thereon that value is just returned. This means that using UUIDs as keys
should be reasonably efficient.
UUIDs can be compared for equality, serialized, cloned and even sorted.
Equality is a simple bit-wise comparison. Ordering (for sorting) is done by
first ordering based on type (in the order of numeric values of types),
secondarily by time stamp (only for time-based time stamps), and finally by
straight numeric byte-by-byte comparison (from most to least significant
bytes).