Printing Java Collections Nicely (toString Doesn't Return Pretty Output)
You could convert it to an array and then print that out with Arrays.toString(Object[])
:
System.out.println(Arrays.toString(stack.toArray()));
String.join(",", yourIterable);
(Java 8)
The MapUtils class offered by the Apache Commons project offers a MapUtils.debugPrint
method which will pretty print your map.