X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2FLangUtils.java;h=1a7a8815e262dd94e5d53becd48370665a36662a;hb=b5644c1dac96afe8b9bdcd68068c054a9f780926;hp=2f99bb3e0d735bb75a99704ce9ffbee2847b560c;hpb=10f1603677f125c014c06cfd3ab956b5589d6e55;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/LangUtils.java b/org.argeo.util/src/org/argeo/util/LangUtils.java index 2f99bb3e0..1a7a8815e 100644 --- a/org.argeo.util/src/org/argeo/util/LangUtils.java +++ b/org.argeo.util/src/org/argeo/util/LangUtils.java @@ -35,6 +35,21 @@ public class LangUtils { return res; } + /* + * MAP + */ + /** + * Creates a new {@link Dictionary} with one key-value pair. Key should not be + * null, but if the value is null, it returns an empty {@link Dictionary}. + */ + public static Map map(String key, Object value) { + assert key != null; + HashMap props = new HashMap<>(); + if (value != null) + props.put(key, value); + return props; + } + /* * DICTIONARY */