我原来遍历Map是这样遍历的:
Map<String,Object> map = new HashMap<String,Object>();
Set<String> keySet = map.keySet();
for (String key : keySet) {
Object o = map.get(key);
}
被findBug找到后,优化为:
Set<Entry<String,Object>> entrySet = map.entrySet();
for (Entry<String, Object> entry : entrySet) {
Object o = entry.getValue();
}
Map遍历
优化Map遍历方法
最新推荐文章于 2025-05-07 18:06:13 发布
226

被折叠的 条评论
为什么被折叠?



