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

Method add

src/jvm/clojure/lang/PersistentTreeMap.java:334–355  ·  view source on GitHub ↗
(Node t, Object key, Object val, Box found)

Source from the content-addressed store, hash-verified

332}
333
334Node add(Node t, Object key, Object val, Box found){
335 if(t == null)
336 {
337 if(comp == RT.DEFAULT_COMPARATOR && !( key == null || (key instanceof Number) || (key instanceof Comparable)))
338 throw new ClassCastException("Default comparator requires nil, Number, or Comparable: " + key);
339 if(val == null)
340 return new Red(key);
341 return new RedVal(key, val);
342 }
343 int c = doCompare(key, t.key);
344 if(c == 0)
345 {
346 found.val = t;
347 return null;
348 }
349 Node ins = c < 0 ? add(t.left(), key, val, found) : add(t.right(), key, val, found);
350 if(ins == null) //found below
351 return null;
352 if(c < 0)
353 return t.addLeft(ins);
354 return t.addRight(ins);
355}
356
357Node remove(Node t, Object key, Box found){
358 if(t == null)

Callers 2

assocExMethod · 0.95
assocMethod · 0.95

Calls 5

doCompareMethod · 0.95
leftMethod · 0.45
rightMethod · 0.45
addLeftMethod · 0.45
addRightMethod · 0.45

Tested by

no test coverage detected