X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2FLangUtils.java;h=1aee28c03c776d7438cc266e4842dee7e21af671;hb=4012bedd8870634488b307d2233590fb1226e5d4;hp=1177d4f5354c53addedc51fddfa10f5d2d71ec25;hpb=a2cb5d55f5d0e44d18fd1a2f5256111ad9fa0015;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 1177d4f53..1aee28c03 100644 --- a/org.argeo.util/src/org/argeo/util/LangUtils.java +++ b/org.argeo.util/src/org/argeo/util/LangUtils.java @@ -94,6 +94,20 @@ public class LangUtils { return res; } + /** Converts a {@link Dictionary} to a {@link Map}. */ + public static Map dictToMap(Dictionary properties) { + if (properties == null) { + return null; + } + Map res = new HashMap<>(properties.size()); + Enumeration keys = properties.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + res.put(key, properties.get(key)); + } + return res; + } + /** * Get a string property from this map, expecting to find it, or * null if not found.