java - 有没有一种转换列表的好方法>> 列出>> 没有 3 个嵌套循环?
- >> 没有 3 个嵌套循环?
问题描述
基本上,如果我有一些映射双功能,是否有这种操作的快捷方式(所以我不必编写 3 个嵌套循环)?
解决方案
List<List<List<String>>> collect = list
.stream()
.map(a -> a
.stream()
.map(b -> b
.stream()
.map(String::valueOf)
.collect(Collectors.toList()))
.collect(Collectors.toList()))
.collect(Collectors.toList());
推荐阅读
- docker - 有没有办法为部署在 GCP 计算实例中的 docker 容器设置“--rm”选项?
- hive - java.lang.IllegalAccessError:试图访问方法 com.google.common.collect.Iterators.emptyIterator()
- android - 数据未在改造中显示
- c++ - 为什么数组到指针的输出不相关
- node.js - 在“...gistry.npmjs.org/loda”附近解析时 JSON 输入意外结束
- php - Contact-Form 7 重新加载页面而不是执行 AJAX
- google-apps-script - 如何为 4 个多个依赖下拉菜单创建脚本?
- c++ - C++ file.close() 提供了额外的时间
- python-3.x - 转换熊猫时间戳列表
- python - 存在数据间隙时如何在 Plotly 中创建正确填充的线条