try final Iterator<String> it = getKeys(); while (it.hasNext())
/** * Returns a configuration with the same content as this configuration, but * with all variables replaced by their actual values. This method tries to * clone the configuration and then perform interpolation on all properties. * So property values of the form <code>${var}</code> will be resolved as * far as possible (if a variable cannot be resolved, it remains unchanged). * This operation is useful if the content of a configuration is to be * exported or processed by an external component that does not support * variable interpolation. * * @return a configuration with all variables interpolated * @throws org.apache.commons.configuration2.ex.ConfigurationRuntimeException if this * configuration cannot be cloned * @since 1.5 */ public Configuration interpolatedConfiguration() { // first clone this configuration final AbstractConfiguration c = (AbstractConfiguration) ConfigurationUtils .cloneConfiguration(this); // now perform interpolation c.setListDelimiterHandler(new DisabledListDelimiterHandler()); for (final Iterator<String> it = getKeys(); it.hasNext();) { final String key = it.next(); c.setProperty(key, getList(key)); } c.setListDelimiterHandler(getListDelimiterHandler()); return c; }
protected static Map<String, String> configurationToMap(AbstractConfiguration configuration) { Iterator<String> keysIterator = configuration.getKeys(); Map<String, String> result = new HashMap<>(); while (keysIterator.hasNext()) { String key = keysIterator.next(); result.put(key, configuration.getString(key)); } return result; }