Maps { public static <T> Map<String, T> kebabToCamelCase(Map<String, T> map) { Map<String, T> result = new HashMap<>(); for (Map.Entry<String, T> entry : map.entrySet()) { String key = entry.getKey(); T value = entry.getValue(); String newKey = Strings.kebabToCamelCase(key); T newValue = value; if (newValue instanceof Map) { newValue = (T) kebabToCamelCase((Map) newValue); } else if (newValue instanceof List) { List newList = new ArrayList<>(); for (Object item : (List) newValue) { if (item instanceof Map) { newList.add(kebabToCamelCase((Map<String, Object>) item)); } else { newList.add(item); } } newValue = (T) newList; } else if (newValue.getClass().isArray()) { List<T> newList = new ArrayList<>(); Arrays.stream((T[]) newValue).forEach(item -> { if (item instanceof Map) { newList.add((T) kebabToCamelCase((Map) item)); } else { newList.add(item); } }); newValue = (T) newList.toArray((T[]) Arrays.copyOf((T[]) newValue, 0)); } result.put(newKey, newValue); } return result; }  static Map<String, String> from(String... values); static Map<String, Object> fromProperties(Map<String, Object> properties); static Map<String, Object> fromProperties(InputStream is); static Map<String, Object> fromYaml(InputStream is); static Map<String, Object> fromAnnotation(String root, A annotation,
      Class<? extends A> type); static Map<String, Object> fromAnnotation(A annotation, Class<? extends A> type); static void merge(Map<String, Object> existing, Map<String, Object> map); static Map<String, T> kebabToCamelCase(Map<String, T> map);  }
@Test public void testKebabToCamelCase() throws Exception { try (InputStream is = MapsTest.class.getClassLoader().getResourceAsStream("kebab.yml")) { Map<String, Object> map = Maps.fromYaml(is); Map<String, Object> result = Maps.kebabToCamelCase(map); Map<String, Object> kubernetes = (Map<String, Object>) result.get("kubernetes"); Map<String, Object> readinesProbe = (Map<String, Object>) kubernetes.get("readinesProbe"); List<Map<String, Object>> envVars = (List<Map<String, Object>>) kubernetes.get("envVars"); System.out.println(envVars); assertEquals("KEY1", envVars.get(0).get("name")); assertEquals("VALUE1", envVars.get(0).get("value")); assertEquals("KEY2", envVars.get(1).get("name")); assertEquals("VALUE2", envVars.get(1).get("value")); assertEquals(10, readinesProbe.get("periodSeconds")); } }