【问题标题】:Iterating over hashmap contained as value within hashmap迭代作为值包含在 hashmap 中的 hashmap
【发布时间】:2015-10-31 15:28:35
【问题描述】:

我有一个父 HashMap 喜欢 Hashmap<String, Hashmap<String,Arraylist<Customclass>>> 现在迭代作为父哈希图的第一个哈希图给了我类似的值

key1-------[subHashmap(value)的key] key2--------[subHashmap(value)的key] . . . 现在我想根据它们的键迭代父哈希图的值中的哈希图。

我将如何做到这一点。 .

【问题讨论】:

    标签: android hashmap


    【解决方案1】:

    应该这样做:

        for (Map.Entry<String, HashMap<String, ArrayList<CustomClass>> entry : outerHashMap.entrySet()) {
    String entryKey= entry.getKey();
    // ...
    for (Map.Entry<String, ArrayList<CustomClass> nestedentry : entry.getValue().entrySet()) {
        String name = nestedEntry.getKey();
        ArrayList<CustomClass> value = nestedEntry.getValue();
        // ...
    }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-02
      • 2012-11-23
      • 2011-03-16
      • 2014-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多