code: public boolean handleOption(String current, Iterator<String> remaining) {
          OptionHelper helper = new GrumpyHelper(log) {
              @Override
              public String get(Option option) {
                  return options.get(option.getText());
              }
  
              @Override
              public void put(String name, String value) {
                  options.put(name, value);
              }
  
              @Override
              public void remove(String name) {
                  options.remove(name);
              }
          };
          for (Option o: javacFileManagerOptions) {
              if (o.matches(current))  {
                  if (o.hasArg()) {
                      if (remaining.hasNext()) {
                          if (!o.process(helper, current, remaining.next()))
                              return true;
                      }
                  } else {
                      if (!o.process(helper, current))
                          return true;
                  }
                  // operand missing, or process returned false
                  throw new IllegalArgumentException(current);
              }
          }
  
          return false;
      }
docs: <editor-fold defaultstate="collapsed" desc="Option handling">