0

Please, How can I make the following code to print out the numbers instead of printing the locations?

    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);
}

output

[[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]

Clara
  • 33
  • 5

0 Answers0