src/main/java/org/organicdesign/fp/collections/PersistentTreeMap.java
@Override public PersistentTreeMap<K,V> assoc(K key, V val) {
        Box<Node<K,V>> found = new Box<>(null);
        Node<K,V> t = add(tree, key, val, found);
        //null == already contains key
        if (t == null) {
            Node<K,V> foundNode = found.val;

            //note only get same collection on identity of val, not equals()
            if (foundNode.getValue() == val) {
                return this;
            }
            return new PersistentTreeMap<>(comp, replace(tree, key, val), size);
        }
        return new PersistentTreeMap<>(comp, t.blacken(), size + 1);
    }
@Override public PersistentTreeMap<K,V> assoc(K key, V val) {
        Box<Node<K,V>> found = new Box<>(null);
        Node<K,V> t = add(tree, key, val, found);
        //null == already contains key
        if (t == null) {
            Node<K,V> foundNode = found.val;

            //note only get same collection on identity of val, not equals()
            if (foundNode.getValue() == val) {
                return this;
            }
            return new PersistentTreeMap<>(comp, replace(tree, key, val), size);
        }
        return new PersistentTreeMap<>(comp, t.blacken(), size + 1);
    }
@ Override public PersistentTreeMap < K , V > assoc ( K key , V val ) { Box < Node < K , V > > found = new Box <> ( null ) ; Node < K , V > t = add ( tree , key , val , found ) ; //null == already contains key if ( t == null ) { Node < K , V > foundNode = found . val ; //note only get same collection on identity of val, not equals() if ( foundNode . getValue ( ) == val ) { return this ; } return new PersistentTreeMap <> ( comp , replace ( tree , key , val ) , size ) ; } return new PersistentTreeMap <> ( comp , t . blacken ( ) , size + 1 ) ; }
{@inheritDoc}
{