遍历 map 的方法

LinkedHashMap<String, String> map = questionContent.getChoiceList();        //拿到一个map<String,String>
for (String key : map.keySet()) { 遍历,替换图片路径
String s = map.get(key);
String[] strarray=s.split(url);
map.replace(key,strarray[1]);
}

这里就是通过map的key 去遍历 map的。其实相当于 for(String s :list )
posted @ 2021-09-27 17:42  了悟  阅读(34)  评论(0编辑  收藏  举报