简体   繁体   English

如何存储List中的值 <Map<String, Object> &gt;进入单独的字符串?

[英]How do I store values from List<Map<String, Object>> into separate Strings?

I have a 我有一个

List<Map<String, Object>> assetSubtypeClassification

which contains the following values: 其中包含以下值:

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

I am looking to split this map into separate Strings for each heading. 我希望将此地图拆分为每个标题的单独字符串。 What is the best way to do this? 做这个的最好方式是什么? Apologies if this is obvious as I am new to this 抱歉,如果这是显而易见的,因为我是新手

You probably? 你可能? want to create a loop to "read" your Object so: 想创建一个循环来“读取”你的对象,所以:

// 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();
      }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Map中获取值 <String List<Object> &gt; - How can I get the values from Map<String List<Object>> 如何将字符串和对象的映射转换为字符串和列表的映射 - How can i convert Map of Strings and Object to a Map of Strings and List 如何在具有相似值的字符串列表中找到特定字符串 - How do I find a specific string in a list of strings with similar values 如何转换的地图 <String, List<Object> &gt;进入 <Object, List<String> &gt;? - How do I convert a Map of <String, List<Object>> into a Map of <Object, List<String>>? 我如何退货清单 <String> 从我发送到put(Object)到地图的方法中(获取示例) - How do I return List<String> from a method where I sent to put(Object) into a map (got example) 如何获取列表的值 <Map<Integer, String> &gt;? - How do I get the values of the List<Map<Integer, String>>? 迭代Map <String,List <Object >>的内容,并将List <Object>的值分配到单独的List <Double>中 - Iterate though the contents of a Map<String,List<Object>> and assign the values of the List<Object> into separate List<Double> 从列表中删除值 <Object> 那是地图的一部分 <String,List<Object> &gt; - Removing values from a List<Object> that is part of a Map<String,List<Object>> 如何从列表中删除字符串并将其存储? - How do I remove a string from a list and store it? 如何映射列表<String>从 JSON 到 JPA - How do I map a List<String> from JSON to JPA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM