private Node<K, V> combine(Node<K, V> l) {
        if (l == null) {
            return null;
        }

        assert l.o_s == null;

        // left-right pass
        Node<K, V> pairs = null;
        Node<K, V> it = l, p_it;
        if (comparator == null) { // no comparator
            while (it != null) {
                p_it = it;
                it = it.y_s;

                if (it == null) {
                    // append last node to pair list
                    p_it.y_s = pairs;
                    p_it.o_s = null;
                    pairs = p_it;
                } else {
                    Node<K, V> n_it = it.y_s;

                    // disconnect both
                    p_it.y_s = null;
                    p_it.o_s = null;
                    it.y_s = null;
                    it.o_s = null;

                    // link trees
                    p_it = link(p_it, it);

                    // append to pair list
                    p_it.y_s = pairs;
                    pairs = p_it;

                    // advance
                    it = n_it;
                }
            }
        } else {
            while (it != null) {
                p_it = it;
                it = it.y_s;

                if (it == null) {
                    // append last node to pair list
                    p_it.y_s = pairs;
                    p_it.o_s = null;
                    pairs = p_it;
                } else {
                    Node<K, V> n_it = it.y_s;

                    // disconnect both
                    p_it.y_s = null;
                    p_it.o_s = null;
                    it.y_s = null;
                    it.o_s = null;

                    // link trees
                    p_it = linkWithComparator(p_it, it);

                    // append to pair list
                    p_it.y_s = pairs;
                    pairs = p_it;

                    // advance
                    it = n_it;
                }
            }
        }

        // second pass (reverse order - due to add first)
        it = pairs;
        Node<K, V> f = null;
        if (comparator == null) {
            while (it != null) {
                Node<K, V> nextIt = it.y_s;
                it.y_s = null;
                f = link(f, it);
                it = nextIt;
            }
        } else {
            while (it != null) {
                Node<K, V> nextIt = it.y_s;
                it.y_s = null;
                f = linkWithComparator(f, it);
                it = nextIt;
            }
        }

        return f;
    }
private Node < K , V > combine ( Node < K , V > l ) { if ( l == null ) { return null ; } assert l . o_s == null ; Node < K , V > pairs = null ; Node < K , V > it = l , p_it ; if ( comparator == null ) { while ( it != null ) { p_it = it ; it = it . y_s ; if ( it == null ) { p_it . y_s = pairs ; p_it . o_s = null ; pairs = p_it ; } else { Node < K , V > n_it = it . y_s ; p_it . y_s = null ; p_it . o_s = null ; it . y_s = null ; it . o_s = null ; p_it = link ( p_it , it ) ; p_it . y_s = pairs ; pairs = p_it ; it = n_it ; } } } else { while ( it != null ) { p_it = it ; it = it . y_s ; if ( it == null ) { p_it . y_s = pairs ; p_it . o_s = null ; pairs = p_it ; } else { Node < K , V > n_it = it . y_s ; p_it . y_s = null ; p_it . o_s = null ; it . y_s = null ; it . o_s = null ; p_it = linkWithComparator ( p_it , it ) ; p_it . y_s = pairs ; pairs = p_it ; it = n_it ; } } } it = pairs ; Node < K , V > f = null ; if ( comparator == null ) { while ( it != null ) { Node < K , V > nextIt = it . y_s ; it . y_s = null ; f = link ( f , it ) ; it = nextIt ; } } else { while ( it != null ) { Node < K , V > nextIt = it . y_s ; it . y_s = null ; f = linkWithComparator ( f , it ) ; it = nextIt ; } } return f ; }
/*
Two pass pair and compute root.