text: 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;}