diff --git a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java index 0516af5c..06a99c02 100644 --- a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java +++ b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java @@ -27,6 +27,7 @@ package org.spongepowered.asm.util; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -232,7 +233,7 @@ public class PrettyPrinter { } return this; } - + public PrettyPrinter addWrapped(String format, Object... args) { return this.addWrapped(this.wrapWidth, format, args); } @@ -324,6 +325,20 @@ public class PrettyPrinter { return this; } + /** + * Add all values of the specified map to this printer as key/value pairs + * + * @param map Map with entries to add + * @return fluent + */ + public PrettyPrinter add(Map map) { + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey() == null ? "null" : entry.getKey().toString(); + this.kv(key, entry.getValue()); + } + return this; + } + /** * Adds a horizontal rule to the output *