code: public static Map<String, String> getMandatoryConfig(
        Configuration config, List<String> keys)
        throws IOException {
      List<String> missingKeys = new ArrayList<>();
      Map<String, String> values = new HashMap<>();
      for (String key : keys) {
        String value = config.get(key);
        if (Strings.isNullOrEmpty(value)) {
          missingKeys.add(key);
        } else {
          values.put(key, value);
        }
      }
      if (missingKeys.size() > 0) {
        Joiner joiner = Joiner.on(", ");
        String message = "Must supply value for configuration settings: " + joiner.join(missingKeys);
        throw new IOException(message);
      }
      return values;
    }
docs: Gets value for the given keys or throws if one or more values are not found.