Java 映射以下数据的键值对?

Java 映射以下数据的键值对?,java,collections,jxl,Java,Collections,Jxl,我有下面的excel工作表,我想将它绑定到键值对的映射(使用JXl解析数据) 我希望数据结构像这样 Map<String,Map<String, List<String>>> map 地图 其中键将是阶段请求集,然后我们有一个阶段请求和阶段顺序的映射 我已经能够在地图i:eMappart中绘制地图了 如何将映射添加到映射中,其中它将是某个键的值 for(int i = 3;i<sheet.getRows();i++){

我有下面的excel工作表,我想将它绑定到键值对的映射(使用JXl解析数据) 我希望数据结构像这样

Map<String,Map<String, List<String>>> map
地图
其中键将是阶段请求集,然后我们有一个阶段请求和阶段顺序的映射

我已经能够在地图i:e
Map
part中绘制地图了

如何将映射添加到映射中,其中它将是某个键的值

              for(int i = 3;i<sheet.getRows();i++){               
                         if(!sheet.getCell(2,i).getContents().isEmpty()){
                             lastUpdated = sheet.getCell(2,i).getContents();                           
                         }

                         if (!sheet.getCell(3,i).getContents().isEmpty()) {
                             String content = sheet.getCell(3,i).getContents();
                             if (map.containsKey(lastUpdated)) {
                                 map.get(lastUpdated).add(content);
                             } else {
                                 ArrayList<String> temp = new ArrayList<String>();
                                 temp.add(content);
                                 map.put(lastUpdated, temp);
                             }
                         }

                     }

for(int i=3;i我相信下面就是您所需要的。如果还不够,请通过任何云存储和您的完整源代码将完整的excel工作表作为文件共享

        Map<String, Map<String, List<String>>> map = new HashMap<>();
        for(int i = 3;i<sheet.getRows();i++){
            if(!sheet.getCell(2,i).getContents().isEmpty()){
                lastUpdated = sheet.getCell(2,i).getContents();
            }

            if (!sheet.getCell(3,i).getContents().isEmpty()) {
                String content = sheet.getCell(3,i).getContents();
                if(!map.containsKey(lastUpdated)){
                    map.put(lastUpdated, new HashMap<>());
                }
                if(!map.get(lastUpdated).containsKey(content)){
                    Map<String, List<String>> rowMap = map.get(lastUpdated);
                    rowMap.put(content, new ArrayList<>());
                    map.put(lastUpdated, rowMap);
                }
                for(Cell c : Arrays.copyOfRange(sheet.getRow(i), 4, sheet.getRow(i).length)){
                    if(CellType.EMPTY != c.getType()){
                        map.get(lastUpdated).get(content).add(c.getContents());
                    }
                }
            }
        }
Map Map=newhashmap();

对于(int i=3;i我相信下面就是您需要的。如果还不够,请通过任何云存储和您的完整源代码将完整的excel工作表作为文件共享

        Map<String, Map<String, List<String>>> map = new HashMap<>();
        for(int i = 3;i<sheet.getRows();i++){
            if(!sheet.getCell(2,i).getContents().isEmpty()){
                lastUpdated = sheet.getCell(2,i).getContents();
            }

            if (!sheet.getCell(3,i).getContents().isEmpty()) {
                String content = sheet.getCell(3,i).getContents();
                if(!map.containsKey(lastUpdated)){
                    map.put(lastUpdated, new HashMap<>());
                }
                if(!map.get(lastUpdated).containsKey(content)){
                    Map<String, List<String>> rowMap = map.get(lastUpdated);
                    rowMap.put(content, new ArrayList<>());
                    map.put(lastUpdated, rowMap);
                }
                for(Cell c : Arrays.copyOfRange(sheet.getRow(i), 4, sheet.getRow(i).length)){
                    if(CellType.EMPTY != c.getType()){
                        map.get(lastUpdated).get(content).add(c.getContents());
                    }
                }
            }
        }
Map Map=newhashmap();

对于(int i=3;iHi@Pavan谢谢,我已经更新了样本Excel表i,因为我使用Map Map u查看Excel表样本stage程序行中的数据有多个值,所以我使用了一个列表来保存这些值。Hi@Pavan谢谢,我已经更新了样本Excel表i,因为我使用Map Map u查看Excel sheet sample阶段程序行中的数据有多个值,所以我使用了一个列表来保存这些值。