java - 如何打印出整数流
问题描述
请问,我怎样才能使下面的代码打印出数字而不是打印位置?
public static void main(String[] args) {
List<Integer> list1 = Arrays.asList(1, 2, 3, 4, 5);
List<Integer> list2 = Arrays.asList(1, 2, 3);
List<int[]> pairs = list1.stream()
.flatMap(l1 -> list2.stream()
.map(l2 -> new int[]{l1, l2}))
.collect(toList());
pairs.forEach(System.out::println);
}
输出
[[I@3b6eb2ec, [I@1e643faf, [I@6e8dacdf, [I@7a79be86, [I@34ce8af7, [I@b684286, [I@880ec60, [I@3f3afe78, [I@7f63425a, [I@36d64342 , [I@39ba5a14, [I@511baa65, [I@340f438e, [I@30c7da1e, [I@5b464ce8]
解决方案
推荐阅读
- mysql - Gorm 不需要`属于`
- python-3.x - 为什么我收到“UnboundLocalError: local variable 'ask2' referenced before assignment”错误?
- python - Pep 8 冲突,导入超过 72 个字符
- r - 给定一个值向量及其对应的概率,返回 CDF(作为函数)
- python - 一些大于 2 的数字不会从列表中删除
- c# - Renci sshnet 重启后重新连接到设备的问题
- wordpress - 如何在 WooCommerce 中为单个产品分配多个元值?
- elasticsearch - ELK - 弹性搜索不显示新消息
- html - 为什么我的复选框驱动的菜单不起作用?
- java - Swagger 可以解析属于某个类的请求映射吗?