本文不再更新,可能存在内容过时的情况,实时更新请移步我的新博客:如何将Map键值的下划线转为驼峰

例,将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);

相关文章:

  • 2021-09-27
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-06-26
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-08-01
  • 2022-03-01
  • 2021-12-31
相关资源
相似解决方案