Java Utililty Methods UUID Create

List of utility methods to do UUID Create

Description

The list of methods to do UUID Create are organized into topic(s).

Method

StringgetUUIDValue(String url, String key)
get UUID Value
return null;
booleanisUUID(String string)
is UUID
try {
    UUID.fromString(string);
    return true;
} catch (Exception ex) {
    return false;
UUIDparseUuid(String s)
parse Uuid
try {
    return UUID.fromString(s);
} catch (IllegalArgumentException e) {
    try {
        return UUID.fromString(s.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
    } catch (IllegalArgumentException e1) {
        return null;
intsizeOfUUID(UUID uuid)
size Of UUID
return 16;
Stringuuid()
Retrieves a universally unique identifier (UUID)
return UUID.randomUUID().toString();
Stringuuid()
uuid
return UUID.randomUUID().toString().replace("-", "");
Stringuuid()
Gets per-thread-unique ID for this thread.
return UUIDS.get();
Stringuuid()
uuid
return UUID.randomUUID().toString().replaceAll("-", "");
UUIDuuidFromString(String s)
uuid From String
if (s.contains("-")) {
    return UUID.fromString(s);
} else {
    return UUID.fromString(
            s.replaceFirst("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)",
                    "$1-$2-$3-$4-$5"));
StringuuidWithTime()
uuid With Time
String time = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
return time + uuid();