// automagically encode a whole map (keys+values) static Map htmlencodeMap(Map o) { new HashMap bla; for (O key : keys(o)) { O value = o.get(key); bla.put(htmlencode(key), htmlencode(value)); } ret bla; }