code: public static Properties extractSubset(final Properties properties, final String prefix) {
          final Properties subset = new Properties();
  
          if (prefix == null || prefix.length() == 0) {
              return subset;
          }
  
          final String prefixToMatch = prefix.charAt(prefix.length() - 1) != '.' ? prefix + '.' : prefix;
  
          final List<String> keys = new ArrayList<>();
  
          for (final String key : properties.stringPropertyNames()) {
              if (key.startsWith(prefixToMatch)) {
                  subset.setProperty(key.substring(prefixToMatch.length()), properties.getProperty(key));
                  keys.add(key);
              }
          }
          for (final String key : keys) {
              properties.remove(key);
          }
  
          return subset;
      }
docs: Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties
  object with the prefix removed.
  
  @param properties The Properties to evaluate.
  @param prefix The prefix to extract.
  @return The subset of properties.