MapConfiguration extends AbstractConfiguration { @Override public Configuration strippedSubset(String prefix) { Map<String, String> subset = subsetMap(prefix); Configuration c = new MapConfiguration(); for (Map.Entry<String, String> entry : subset.entrySet()) { String strippedKey = entry.getKey().replaceFirst(Pattern.quote(prefix), ""); c.setProperty(strippedKey, entry.getValue()); } return c; } MapConfiguration();  MapConfiguration(Map<String, String> configMap);  MapConfiguration(Configuration config); @Override Configuration subset(String prefix); @Override Configuration strippedSubset(String prefix); static MapConfiguration merge(Configuration ... configs); @Override boolean isEmpty(); @Override boolean containsKey(String key); @Override void setProperty(String key, String value); @Override void clear(); @Override void clearProperty(String key); @Override Iterable<String> getKeys(); @Override String getProperty(String key); @Override String getProperty(String key, String defaultValue); @Override String toString();  }
@Test public void testStrippedSubset() { config.setProperty("a.b.a.b", "value"); config.setProperty("a.b.c.d", "value"); config.setProperty("a.c.a.b", "value"); config.setProperty("a.d.a.b", "value"); Configuration stripped = config.strippedSubset("a.b."); assertFalse(stripped.containsKey("a.b.a.b")); assertTrue(stripped.containsKey("a.b")); assertTrue(stripped.containsKey("c.d")); assertFalse(stripped.containsKey("a.c.a.b")); assertFalse(stripped.containsKey("a.d.a.b")); }