map put值 使用匿名函数

 1       List<Map<String, Object>> list = setRoleMenuRlMapper.selectMapByParams(params);
 2 //         Map map = new HashMap<String, Object>();
 3 //         map.put("hahaha","111");
 4 //         map.put("xixi", "22222222");
 5 //        list.add(map);
 6         
 7         
 8         list.add(new HashMap<String, Object>() {
 9             {
10             put("haha","1111");
11             put("xixi", "22222222");}
12         });

代码块会 执行

posted @ 2018-09-15 00:28  好难取名  阅读(791)  评论(0编辑  收藏  举报