mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-22 15:29:45 +00:00
Convenience method for Map instances
This commit is contained in:
1 parent
8e891daa92
commit
6978f25855
1 file changed
+16
-1
@@ -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
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user