很简单,核心方法就是map.putAll()方法。例子如下:
Map<String,Object> orders = ordersService.getOrderInfo(xxx); //原来的map
Map<String,Object> ordersBK = new HashMap<>(); //需要与原来map分离出来的新业务的map
ordersBK.putAll(orders); //进行复制
//添加其他额外参数
ordersBK.put("xxx","xxx");
...
很简单,核心方法就是map.putAll()方法。例子如下:
Map<String,Object> orders = ordersService.getOrderInfo(xxx); //原来的map
Map<String,Object> ordersBK = new HashMap<>(); //需要与原来map分离出来的新业务的map
ordersBK.putAll(orders); //进行复制
//添加其他额外参数
ordersBK.put("xxx","xxx");
...