MCPcopy Index your code
hub / github.com/clojure/clojure / assoc

Method assoc

src/jvm/clojure/lang/PersistentHashMap.java:137–149  ·  view source on GitHub ↗
(Object key, Object val)

Source from the content-addressed store, hash-verified

135}
136
137public IPersistentMap assoc(Object key, Object val){
138 if(key == null) {
139 if(hasNull && val == nullValue)
140 return this;
141 return new PersistentHashMap(meta(), hasNull ? count : count + 1, root, true, val);
142 }
143 Box addedLeaf = new Box(null);
144 INode newroot = (root == null ? BitmapIndexedNode.EMPTY : root)
145 .assoc(0, hash(key), key, val, addedLeaf);
146 if(newroot == root)
147 return this;
148 return new PersistentHashMap(meta(), addedLeaf.val == null ? count : count + 1, newroot, hasNull, nullValue);
149}
150
151public Object valAt(Object key, Object notFound){
152 if(key == null)

Callers 1

assocExMethod · 0.95

Calls 3

metaMethod · 0.95
hashMethod · 0.95
assocMethod · 0.65

Tested by

no test coverage detected