code: public static <T> T required(Map<String, T> map, String key) {
          if (!map.containsKey(key)) {
              String message = String.format("Missing required value for key \"%s\".",
                                             key);
              throw new NoSuchElementException(message);
          }
  
          return map.get(key);
      }
docs: Validates that the value from {@code map} for the given {@code key} is
  a present. Returns the value when present; otherwise, throws a
  {@code NoSuchElementException}.
  @param map a map
  @param key a key
  @param <T> the type of value
  @return the string value
  @throws java.util.NoSuchElementException if the required value is not
  present