There is an array:
Integer[] sums = new Integer[5]; pre-filled with items.
To output elements c of a new line using java-8 functional, use:
Arrays.stream(sums).forEach(System.out::println); How to make a conclusion, for example, in one line, separated by a comma (after the last element, nothing) using java8?
In one line print () , it seems impossible to add a comma inside forEach () . So you still need to check the condition on the last element.