code: protected final void parse(List<String> args) {
      Pattern eqSeparatedOpt = Pattern.compile("(--[^=]+)=(.+)");
  
      int idx = 0;
      for (idx = 0; idx < args.size(); idx++) {
        String arg = args.get(idx);
        String value = null;
  
        Matcher m = eqSeparatedOpt.matcher(arg);
        if (m.matches()) {
          arg = m.group(1);
          value = m.group(2);
        }
  
        // Look for options with a value.
        String name = findCliOption(arg, opts);
        if (name != null) {
          if (value == null) {
            if (idx == args.size() - 1) {
              throw new IllegalArgumentException(
                  String.format("Missing argument for option '%s'.", arg));
            }
            idx++;
            value = args.get(idx);
          }
          if (!handle(name, value)) {
            break;
          }
          continue;
        }
  
        // Look for a switch.
        name = findCliOption(arg, switches);
        if (name != null) {
          if (!handle(name, null)) {
            break;
          }
          continue;
        }
  
        if (!handleUnknown(arg)) {
          break;
        }
      }
  
      if (idx < args.size()) {
        idx++;
      }
      handleExtraArgs(args.subList(idx, args.size()));
    }
docs: Parse a list of spark-submit command line options.
  <p>
  See SparkSubmitArguments.scala for a more formal description of available options.
  
  @throws IllegalArgumentException If an error is found during parsing.