code: public static <T> String populatedStringOfType(Map<String, T> map, String key, String type) {
          String value = requiredStringOfType(map, key, type);
  
          if (value.trim().equals("")) {
              String message = String.format("Value \"%s\" for key \"%s\" must be populated.",
                                             value,
                                             key);
              throw new IllegalArgumentException(message);
          }
  
          return value;
      }
docs: Validates that the value from {@code map} for the given {@code key} is
  a populated string. Returns the value when valid; otherwise, throws an
  {@code IllegalArgumentException}, referring to the value as being of
  type{@code} type in the error message.
  @param map a map
  @param key a key
  @param type a type label
  @param <T> the type of value
  @return the string value
  @throws java.util.NoSuchElementException if the required value is not
  present
  @throws java.lang.IllegalArgumentException if the value is in valid