package com.mapping;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MapTest {
public static void main(String[] args) {
/*Map<String, String> map = new HashMap<String, String>();
String version_Id = "";
map.put("VERSION_ID", version_Id); //点击编辑/处理时只有 AREA_ID
map.put("one","one");
map.put("two","two");
map.put("one","three");
for (Map.Entry<String, String> entry : map.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
System.out.println(map.size());
//System.out.println(a.get("d"));
*
*/
List<Map<String,Object>> queryQzBySxList = new ArrayList<Map<String,Object>>();
Map<String,Object> map1 = new HashMap<String,Object>();
map1.put("a","aa");
map1.put("b","bb");
map1.put("c","cc");
queryQzBySxList.add(map1);
Map<String,Object> map2 = new HashMap<String,Object>();
map2.put("d","dd");
map2.put("e","ee");
map2.put("f","ff");
queryQzBySxList.add(map2);
String bussinessChildType="dd";
boolean flag = false;
for(Map<String,Object> map:queryQzBySxList){
if(map.containsValue(bussinessChildType)){
flag = true;
break;
}
/*
for(Map.Entry<String,Object> map : queryQzBySxList.entrySet()){
System.out.println(map.getKey()+ " : "+map.getValue());
}
*/
System.out.println(map.get("a"));
}
if(!flag){
System.out.println("完蛋,找不到!");
}else{
System.out.println("遍历成功");
}
}
}
遍历 List-Map-String-Object-
最新推荐文章于 2023-04-17 13:48:04 发布