private static boolean isValidName(String name) {
    for (int i = 0; i < name.length(); i++) {
      char c = name.charAt(i);
      if (!(c == '-' || c == '_' || Character.isLetterOrDigit(c))) {
        return false;
      }
    }

    return true;
  }
private static boolean isValidName(String name)