java从嵌套映射中删除元素
我有地图结构
Map<Integer, Map<String, String>> outerMap= getMap();
for (int count = 0; count < outerMap.size(); count++) {
Map<String, String> innerMap = outerMap.get(count);
String tempValue = innerMap.get("tempKey");
innerMap.remove("tempKey");
someOperations(tempValue);
}
当我在第一次迭代时从内部映射中删除它时,它会从其他映射中删除该键和值对,但这不是我想要的。有什么建议吗
共 (0) 个答案