public Map add(object key, object val) { modify(); if (key == null) throw NullErr.make("key is null").val; if (!isImmutable(key)) throw NotImmutableErr.make("key is not immutable: " + @typeof(key)).val; if (containsKey(key)) throw ArgErr.make("Key already mapped: " + key).val; m_map[key] = val; return this; }
static void addProp(Map props, string n, string v, bool listVals) { if (listVals) { List list = (List)props.get(n); if (list == null) { props.add(n, list = new List(Sys.StrType)); } list.add(v); } else { props.add(n, v); } }