List<Map.Entry<String, List<List<Object>>>> entryList = new ArrayList<>(scoreDetailMap.entrySet());

List<String> sheetNames = entryList.stream() .map(Map.Entry::getKey) .collect(Collectors.toList());

List<List<List<Object>>> contents = entryList.stream() .map(Map.Entry::getValue) .collect(Collectors.toList());

entryList.forEach(entry -> System.out.println("方法三的key为:" + entry.getKey() + ", value为:" + entry.getValue()));

使用Stream流遍历Map获取键值对并转换为List

原文地址: https://www.cveoy.top/t/topic/pxsL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录