public static Map<String, Object> replaceHump(Map<String, Object> oldMap) {
Map<String, Object> newObjectMap = new HashMap<String, Object>();
Set<Map.Entry<String, Object>> entries = oldMap.entrySet();
Iterator<Map.Entry<String, Object>> iterator = entries.iterator();
while (iterator.hasNext()) {
Map.Entry<String, Object> next = iterator.next();
String key = next.getKey();
if (StringUtils.contains(key, "_")) {
Object value = oldMap.get(key);
String newKey = Util.toCamelCase(key);
newObjectMap.put(newKey, value);
iterator.remove();
}
}
for (String newStrKey : newObjectMap.keySet()) {
oldMap.put(newStrKey, newObjectMap.get(newStrKey));
}
return newObjectMap;
}
原文:https://www.cnblogs.com/osmoba/p/15012042.html