android问题的哈希映射

android问题的哈希映射,android,collections,hashmap,Android,Collections,Hashmap,为什么我们在数组列表中添加哈希映射。例如 HashMap<String,String> hashMap = new HashMap<String,String>(); hashMap.put("1","bmw"); hashMap.put("2","mercedez"); hashMap.put("3","audi"); hashMap.put("4",

为什么我们在数组列表中添加哈希映射。例如

            HashMap<String,String> hashMap = new HashMap<String,String>();
            hashMap.put("1","bmw");
            hashMap.put("2","mercedez");
            hashMap.put("3","audi");
            hashMap.put("4","sunny");

            ArrayList<HashMap<String,String>> arrayList =new ArrayList<HashMap<String,String>>();
            arrayList.add(hashMap);

我们可以像hashMap1一样直接从hashmap中获取数据;像这样

我们可以直接从hashmap中获取数据,比如hashmap.get1

阅读您在哪里发现向arraylist添加hashmap?人们这样做是因为他们可能不知道JavaBean/model类的概念。这个答案意味着什么?对不起!我的错!更正@VivekMishra