Goal
Print all elements in List with Java 8 without Lambdas and a short hand input.
Setup
In following code lets fill in the blanks to print all elements of given list.
Print all elements in List with Java 8 without Lambdas and a short hand input.
Setup
In following code lets fill in the blanks to print all elements of given list.
@Test
public void SimpleCollection() {
List values = Arrays.asList(1, 2, 3, 4, 5, 6);
values.forEach(/* fill the code here */);
}
Solution
As the solution is small and trivial the output looks as follows.
@Test
public void SimpleCollection() {
List values = Arrays.asList(1, 2, 3, 4, 5, 6);
values.forEach(System.out::println);
}