In Java, I want to print the contents of a Stack. The toString() method prints them encased in square brackets delimited by commas: [foo, bar, ba
toString()
[foo, bar, ba
stack.forEach(System.out::println);
Using Java 8 and later stream functions