创建一个list 里面方对象的方法

List list =  new  ArrayList<hashmap<string,string>>();

Map map =  new  HashMap<string,string>();

map.put( "1" , "CSDN" );

list.add(map);

 

 

 

后记:

Map map =  new  HashMap<string,string>();

上面这句写法是有问题的

超哥说 new后面规定的类型 前面的Map是不知道的,但是前面规定了 后面可以知道,所以正确的写法是

Map<String,String> map = new HashMap();
map.put( "1" , "CSDN" );

原文地址:https://www.cnblogs.com/kaibindirver/p/15797279.html