[英]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.