我相信下面就是你需要的。如果还不够,请通过任何云存储和完整的源代码将完整的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());
}
}
}
}