1Z0-809 : About enthuware.ocpjp.v8.2.1773
Posted: Sun Mar 04, 2018 1:17 am
hi,
I got a question:
Given:
List<String> l1 = Arrays.asList("a", "b");
List<String> l2 = Arrays.asList("1", "2");
Which of the following lines of code will print the following values?
a
b
1
2
The correct answer is this one: Stream.of(l1, l2).flatMap((x)->x.stream()).forEach((x)->System.out.println(x));
but when I tried on my ide I'm still getting this result:
[a, b]
[1, 2]
the result that is the same as this one: Stream.of(l1, l2).forEach((x)->System.out.println(x));
[a, b]
[1, 2]
which I choose in first place.
so, what is the correct answer in the end?
thank you,
Stefan
I got a question:
Given:
List<String> l1 = Arrays.asList("a", "b");
List<String> l2 = Arrays.asList("1", "2");
Which of the following lines of code will print the following values?
a
b
1
2
The correct answer is this one: Stream.of(l1, l2).flatMap((x)->x.stream()).forEach((x)->System.out.println(x));
but when I tried on my ide I'm still getting this result:
[a, b]
[1, 2]
the result that is the same as this one: Stream.of(l1, l2).forEach((x)->System.out.println(x));
[a, b]
[1, 2]
which I choose in first place.
so, what is the correct answer in the end?
thank you,
Stefan