方法一:
System.out.println("通过iterator遍历所有的value,但是不能遍历key");
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<String, String> next = iterator.next();
System.out.println("key="+next.getKey()+"value="+next.getValue());
}
方法二
//遍历mapkey
//分组创建map集合
Map<String, List<ICFaInvestigationNorm>> evaluationTitleDTOMap = evaluationTitleDTOS.stream().collect(Collectors.toMap(EvaluationTitleDTO::getThirdTitleCode, EvaluationTitleDTO::getChildren));
//遍历mapkey
for (String thirdTitle : evaluationTitleDTOMap.keySet()){
//根据key获取值
List<ICFaInvestigationNorm> icFaInvestigationNormList =
evaluationTitleDTOMap.get(thirdTitle);
}