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

Method assocN

src/jvm/clojure/lang/PersistentVector.java:176–193  ·  view source on GitHub ↗
(int i, Object val)

Source from the content-addressed store, hash-verified

174}
175
176public PersistentVector assocN(int i, Object val){
177 if(i >= 0 && i < cnt)
178 {
179 if(i >= tailoff())
180 {
181 Object[] newTail = new Object[tail.length];
182 System.arraycopy(tail, 0, newTail, 0, tail.length);
183 newTail[i & 0x01f] = val;
184
185 return new PersistentVector(meta(), cnt, shift, root, newTail);
186 }
187
188 return new PersistentVector(meta(), cnt, shift, doAssoc(shift, root, i, val), tail);
189 }
190 if(i == cnt)
191 return cons(val);
192 throw new IndexOutOfBoundsException();
193}
194
195private static Node doAssoc(int level, Node node, int i, Object val){
196 Node ret = new Node(node.edit,node.array.clone());

Callers 1

parseMethod · 0.95

Calls 4

tailoffMethod · 0.95
metaMethod · 0.95
doAssocMethod · 0.95
consMethod · 0.95

Tested by

no test coverage detected