Junior — Senior
Research of Stream API behavior in Java
livecode
Task condition
This example shows a chain of Stream API calls. It is necessary to determine what output will appear in the console when the test() method is executed.
void test() {
Stream.of("a", "b", "c")
.map(letter -> {
System.out.println(letter.toUpperCase());
return letter.toUpperCase();
})
.map(letter -> {
System.out.println(letter + 1);
return letter + 1;
});
}