zoukankan      html  css  js  c++  java
  • Map<String, List<Map<String,Object>>>

    装载解析  Map<String, List<Map<String,Object>>>

           // Map<String, List<Map<String,Object>>>
                //1、先装载 Map<String,Object>
                //2、再装载 List<Map<String,Object>>
                //3、最后装载 Map<String, List<Map<String,Object>>>
    
                List<Map<String,Object>> dataList1 = new ArrayList<Map<String,Object>>();
    
                Map<String, Object> map1 = new HashMap<String, Object>();
                map1.put("QUALITY_CODE","20200107");
                map1.put("AUTH_NAME","证书1");
                map1.put("EXPRESSIONDESC","4和3都满足");
                Map<String, Object> map2 = new HashMap<String, Object>();
                map2.put("QUALITY_CODE","20200107");
                map2.put("AUTH_NAME","证书2");
                map2.put("EXPRESSIONDESC","4证书满足");
    
                JSONObject jsonObject1 = new JSONObject(map1);
                JSONObject jsonObject2 = new JSONObject(map2);
                dataList1.add(jsonObject1);
                dataList1.add(jsonObject2);
                //装载到 List<Map<String,Object>>中
                System.out.println("dataList1:"+ dataList1);
                System.out.println("==========dataList1==========");
    
                List<Map<String,Object>> dataList2 = new ArrayList<Map<String,Object>>();
    
                Map<String, Object> map3 = new HashMap<String, Object>();
                map3.put("QUALITY_CODE","20200107");
                map3.put("AUTH_NAME","证书3");
                map3.put("EXPRESSIONDESC","4和3都满足");
                Map<String, Object> map4 = new HashMap<String, Object>();
                map4.put("QUALITY_CODE","20200107");
                map4.put("AUTH_NAME","证书4");
                map4.put("EXPRESSIONDESC","4证书满足");
    
                JSONObject jsonObject3 = new JSONObject(map3);
                JSONObject jsonObject4 = new JSONObject(map4);
                dataList2.add(jsonObject3);
                dataList2.add(jsonObject4);
                //装载到 List<Map<String,Object>>中
                System.out.println(dataList2);
                System.out.println("=========dataList2===========");
    
                // 装载到 Map<String, List<Map<String,Object>>>
                Map<String, List<Map<String, Object>>> stringListMap = new HashMap<>();
                stringListMap.put("key1", dataList1);
                stringListMap.put("key2", dataList2);
                System.out.println(stringListMap);
                System.out.println("stringListMap.keySet: "+stringListMap.keySet());
                System.out.println("=========keySet===========");
                for (String s : stringListMap.keySet()) {
                    List<Map<String, Object>> listMap = stringListMap.get(s);
                    System.out.println(listMap);
                    System.out.println("=========listMap===========");
                    for (Map<String, Object> map : listMap) {
                        Set<String> stringKey = map.keySet();
                        System.out.println(stringKey); // [AUTH_NAME, QUALITY_CODE, EXPRESSIONDESC]
                        System.out.println("=========stringKey===========");
                        for (String k : stringKey) {
                            Object value = map.get(k);
                            System.out.println(k+"的值:"+value+"
    ");
                        }
                    }
                }
  • 相关阅读:
    webpack学习笔记--配置总结
    webpack学习笔记--多种配置类型
    webpack学习笔记--整体配置结构
    webpack学习笔记--其它配置项
    webpack学习笔记--配置devServer
    webpack学习笔记--配置plugins
    webpack学习笔记--配置resolve
    webpack学习笔记--配置module
    webpack学习笔记--配置output
    webpack学习笔记--配置entry
  • 原文地址:https://www.cnblogs.com/liyh321/p/14949039.html
Copyright © 2011-2022 走看看