code: private Duration parseDurationUsingTypeSafeSpec(final String path, final String durationString) {
  
          /* Check to see if any of the postfixes are at the end of the durationString. */
          final Optional<Map.Entry<TimeUnit, List<String>>> entry = timeUnitMap.entrySet().stream()
                  .filter(timeUnitListEntry ->
                          /* Go through values in map and see if there are any matches. */
                          timeUnitListEntry.getValue()
                                  .stream()
                                  .anyMatch(durationString::endsWith))
                  .findFirst();
  
          /* if we did not match any postFixes then exit early with an exception. */
          if (!entry.isPresent()) {
              throw new IllegalArgumentException("Path " + path + " does not resolve to a duration " + durationString);
          }
  
          /*  Convert the value to a Duration.
           */
          Optional<Duration> optional = entry.map(timeUnitListEntry -> {
  
              /* Find the prefix that matches the best. Prefixes are ordered by length.
              * Biggest prefixes are matched first.
              */
              final Optional<String> postFix = timeUnitListEntry
                      .getValue()
                      .stream()
                      .filter(durationString::endsWith)
                      .findFirst();
  
              if (postFix.isPresent()) {
              /* Remove the prefix from the string so only the unit remains. */
                  final String unitString = durationString.replace(postFix.get(), "").trim();
  
              /* Try to parse the units, if the units do not parse than they gave us a bad prefix. */
                  try {
                      long unit = Long.parseLong(unitString);
                      return Duration.ofNanos(timeUnitListEntry.getKey().toNanos(unit));
                  } catch (NumberFormatException nfe) {
                      throw new IllegalArgumentException("Path does not resolve to a duration " + durationString);
                  }
              } else {
                  throw new IllegalArgumentException("Path does not resolve to a duration " + durationString);
              }
          });
          if (optional.isPresent()) {
              return optional.get();
          } else {
              throw new IllegalArgumentException("Path does not resolve to a duration " + durationString);
          }
      }
docs: Parses a string into duration type safe spec format if possible.
  
  @param path           property path
  @param durationString duration string using "10 seconds", "10 days", etc. format from type safe.
  @return Duration parsed from typesafe config format.