Multi-line pretty-printing of (nested) collections in Java

后端 未结 4 647
-上瘾入骨i
-上瘾入骨i 2020-12-17 22:39

I want to be able to (pretty-)print the contents of my maps.

They should have newlines and indentation rather than on a single line; ignoring the toString methods of

4条回答
  •  庸人自扰
    2020-12-17 22:53

    Try replacing the start of each entry with new line and tab like this

    myMap.toString().replace("[", "\n\t[");

提交回复
热议问题