求个android开发大神 帮我取出List<Map<String,Object>gt;中的值
展开全部
private static void test10(){
List<Map<String,Object>> maps = new ArrayList<>();
Map<String,Object> hashMap = new HashMap<>();
hashMap.put("key1","value1");
hashMap.put("key2","value2");
hashMap.put("key3","value3");
maps.add(hashMap);
hashMap = new HashMap<>();
hashMap.put("key11","value11");
hashMap.put("key21","value21");
hashMap.put("key31","value31");
maps.add(hashMap);
for (Map<String,Object> map:maps){
Set set = map.keySet();
Iterator iterator = set.iterator();
while (iterator.hasNext()){
String key = (String) iterator.next();
Object value = map.get(key);
System.out.println(key);
System.out.println(value);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询