code: public static boolean isUuid(final String uuid) {
          return uuid != null && (uuid.length() == 36 || uuid.length() == 32)
                  && UUID_PATTERN.matcher(uuid).matches();
      }
docs: Returns true if the given input is a UUID (accepts UUIDs with or without hyphens)
  
  @param uuid
  candidate UUID
  @return UUID