public Ref put(String keyName, Ref value) {String name = toRefName(keyName);if (!name.equals(value.getName()))throw new IllegalArgumentException();if (!resolved.isEmpty()) {for (Ref ref : resolved)loose = loose.put(ref);resolved = RefList.emptyList();}int idx = loose.find(name);if (0 <= idx) {Ref prior = loose.get(name);loose = loose.set(idx, value);return prior;}Ref prior = get(keyName);loose = loose.add(idx, value);sizeIsValid = false;return prior;}

public override Ref Put(string keyName, Ref value){string name = ToRefName(keyName);if (!name.Equals(value.GetName())){throw new ArgumentException();}if (!resolved.IsEmpty()){foreach (Ref @ref in resolved){loose = loose.Put(@ref);}resolved = RefList.EmptyList();}int idx = loose.Find(name);if (0 <= idx){Ref prior = loose.Get(name);loose = loose.Set(idx, value);return prior;}else{Ref prior = Get(keyName);loose = loose.Add(idx, value);sizeIsValid = false;return prior;}}
