首页 > 学院 > 开发设计 > 正文

List转为map

2019-11-11 01:57:39
字体:
来源:转载
供稿:网友
在for循环里每次都new一个新的Map,最终返回resultList
List<Map> resultList = new ArrayList<>();		List<Item> itemList = this.list(Conds.get());		Map<String, Object> hm = new HashMap<String, Object>();		for(Item it:itemList){			hm = new HashMap<String, Object>();			hm.put("title", it.getItemName());			resultList.add(hm);		}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表