UaaMapUtils { public static Map<String, Object> flatten(Map<String, Object> map) { HashMap<String, Object> result = new HashMap<>(); if (map == null || map.isEmpty()) { return result; } NestedMapPropertySource properties = new NestedMapPropertySource("map", map); for (String property : properties.getPropertyNames()) { if (properties.getProperty(property) != null) { result.put(property, properties.getProperty(property)); } } return result; }  static Map<String, Object> flatten(Map<String, Object> map); static Map<String, Object> getPropertiesStartingWith(ConfigurableEnvironment aEnv,
                                                                String aKeyPrefix); static Map<String, Object> getAllProperties(ConfigurableEnvironment aEnv); static Map<String, Object> getAllProperties(PropertySource<?> aPropSource); @SafeVarargs static Map<K, V> map(E... entries); static Map.Entry<K, V> entry(K key, V value); static Map<K, V> sortByKeys(Map<K,V> map); static String prettyPrintYaml(Map<K,V> map); static Map<String, ?> redactValues(Map<String, ?> map);  }
@Test public void testFlatten() { Map<String,Object> flat = UaaMapUtils.flatten(top); assertSame(emptyMap, flat.get("secondB.thirdC.emptyMap")); assertSame(secondA, flat.get("secondA")); assertEquals("valueC", flat.get("secondB.thirdC.keyC")); }