如何将List <map <string,object =“” >>中的值存储到单独的字符串中?

时间:2019-03-25 10:43:36

标签: java string list

我有一个

List<Map<String, Object>> assetSubtypeClassification

其中包含以下值:

[{AssetName=HVAC, AssetSubTypeName=AHU, AssetClassificationName=Electric/Heat Recovery, FaultTypeName=No Power}]

我正在寻找将该地图分为每个标题的单独字符串。做这个的最好方式是什么?道歉,如果这很明显,因为我是新来的

1 个答案:

答案 0 :(得分:0)

可能是吗?想要创建一个循环来“读取”您的对象,这样:

// go through the ArrayList 
    for (Map hashMap : assetSubtypeClassification) {
      // for each hashmap get the key and value
      for (Map.Entry<String, String> item : hashMap.entrySet()) {
          String key = item.getKey();
          String value = item.getValue();
      }
    }