@Test void testUnflattenConflict2() { final Map<String, Object> data = new LinkedHashMap<>(); data.put("foo", "bar"); data.put("foo.baz", "baz"); assertThatIllegalStateException() .isThrownBy(() -> NestedMaps.unflatten(data)) .withMessage("Conflicting data types for key 'foo.baz'"); }
public static Map<String, Object> unflatten(Map<String, Object> flattened) { Map<String, Object> unflattened = new HashMap<>(); for (Map.Entry<String, Object> entry : flattened.entrySet()) { doUnflatten(unflattened, entry.getKey(), entry.getValue()); } return unflattened; }
NestedMaps { public static Map<String, Object> unflatten(Map<String, Object> flattened) { Map<String, Object> unflattened = new HashMap<>(); for (Map.Entry<String, Object> entry : flattened.entrySet()) { doUnflatten(unflattened, entry.getKey(), entry.getValue()); } return unflattened; } }
NestedMaps { public static Map<String, Object> unflatten(Map<String, Object> flattened) { Map<String, Object> unflattened = new HashMap<>(); for (Map.Entry<String, Object> entry : flattened.entrySet()) { doUnflatten(unflattened, entry.getKey(), entry.getValue()); } return unflattened; } private  NestedMaps(); }
NestedMaps { public static Map<String, Object> unflatten(Map<String, Object> flattened) { Map<String, Object> unflattened = new HashMap<>(); for (Map.Entry<String, Object> entry : flattened.entrySet()) { doUnflatten(unflattened, entry.getKey(), entry.getValue()); } return unflattened; } private  NestedMaps(); @SuppressWarnings("unchecked") static Optional<T> getValue(Map<String, Object> data, String path); static Map<String, T> deepMerge(final Stream<Map<String, T>> mapStream); @SuppressWarnings({ "rawtypes", "unchecked" }) static void deepMerge(Map left, Map right); static Map<String, Object> unflatten(Map<String, Object> flattened); }
NestedMaps { public static Map<String, Object> unflatten(Map<String, Object> flattened) { Map<String, Object> unflattened = new HashMap<>(); for (Map.Entry<String, Object> entry : flattened.entrySet()) { doUnflatten(unflattened, entry.getKey(), entry.getValue()); } return unflattened; } private  NestedMaps(); @SuppressWarnings("unchecked") static Optional<T> getValue(Map<String, Object> data, String path); static Map<String, T> deepMerge(final Stream<Map<String, T>> mapStream); @SuppressWarnings({ "rawtypes", "unchecked" }) static void deepMerge(Map left, Map right); static Map<String, Object> unflatten(Map<String, Object> flattened);  }