public class FastUUID extends Object
A utility class for quickly and efficiently parsing UUID instances from strings and writing UUID
instances as strings. The methods contained in this class are optimized for speed and to minimize garbage collection
pressure. In benchmarks, parseUUID(CharSequence) is a little more than 14 times faster than
UUID.fromString(String), and toString(UUID) is a little more than six times faster than
UUID.toString() when compared to the implementations in Java 8 and older. Under Java 9 and newer,
parseUUID(CharSequence) is about six times faster than the JDK implementation and toString(UUID)
does not offer any performance enhancements (or regressions!).
| Modifier and Type | Method and Description |
|---|---|
static UUID |
parseUUID(CharSequence uuidSequence)
Parses a UUID from the given character sequence.
|
static String |
toString(UUID uuid)
Returns a string representation of the given UUID.
|
public static UUID parseUUID(CharSequence uuidSequence)
UUID.toString().uuidSequence - the character sequence from which to parse a UUIDIllegalArgumentException - if the given character sequence does not conform to the string representation as
described in UUID.toString()public static String toString(UUID uuid)
UUID.toString().uuid - the UUID to represent as a stringCopyright © 2018. All rights reserved.