| 124 | } |
| 125 | |
| 126 | public PersistentTreeMap assoc(Object key, Object val){ |
| 127 | Box found = new Box(null); |
| 128 | Node t = add(tree, key, val, found); |
| 129 | if(t == null) //null == already contains key |
| 130 | { |
| 131 | Node foundNode = (Node) found.val; |
| 132 | if(foundNode.val() == val) //note only get same collection on identity of val, not equals() |
| 133 | return this; |
| 134 | return new PersistentTreeMap(comp, replace(tree, key, val), _count, meta()); |
| 135 | } |
| 136 | return new PersistentTreeMap(comp, t.blacken(), _count + 1, meta()); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | public PersistentTreeMap without(Object key){ |