例,将HashMap实例extMap键值下划线转为驼峰:
代码:
HashMap<String,Object> extMap = new HashMap<>();
extMap.put("ORGAN_NAME","四个空格");
extMap.put("WEB_SITE","https://www.4spaces.org");
HashMap camelcaseExtMap = new HashMap();
for (Map.Entry<String, Object> entry : extMap.entrySet()) {
camelcaseExtMap.put(CaseUtils.toCamelCase(entry.getKey(), false, new char[]{'_'}), entry.getValue());
}
camelcaseExtMap.keySet().stream().forEach(System.out::println);