遍历List集合中的Map集合:

首先遍历list集合,在list集合中在遍历map集合。
这里使用到增强for,和Iterator迭代器循环map集合。
map集合:有多种遍历方式(百度搜一下),这里由于业务需求使用了迭代器Iterator,
直接上码~~~

List<Map<String, Object>> findItemAdd = salaryDao.findItemAdd();
		//遍历list
		for (Map<String, Object> map : findItemAdd) {
			// 遍历map
			Iterator<Entry<String, Object>> it = map.entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry<String, Object> entry = it.next();
				 System.out.println("key: " + entry.getKey() + " ~~~ value: " +
				 entry.getValue());
			}
		}

常用map集合遍历:百度很多
map遍历

猜你喜欢

转载自blog.csdn.net/weixin_43494908/article/details/83986831