src/main/java/org/organicdesign/fp/collections/RrbTree.java
public RrbTree<E> without(int index) {
        if ( (index > 0) && (index < size() - 1) ) {
            Tuple2<? extends RrbTree<E>,? extends RrbTree<E>> s1 = split(index);
            Tuple2<? extends RrbTree<E>,? extends RrbTree<E>> s2 = s1._2().split(1);
            return s1._1().join(s2._2());
        } else if (index == 0) {
            return split(1)._2();
        } else if (index == size() - 1) {
            return split(size() - 1)._1();
        } else {
            throw new IndexOutOfBoundsException("Failed test: 0 <= index < size");
        }
    }
public RrbTree<E> without(int index) {
        if ( (index > 0) && (index < size() - 1) ) {
            Tuple2<? extends RrbTree<E>,? extends RrbTree<E>> s1 = split(index);
            Tuple2<? extends RrbTree<E>,? extends RrbTree<E>> s2 = s1._2().split(1);
            return s1._1().join(s2._2());
        } else if (index == 0) {
            return split(1)._2();
        } else if (index == size() - 1) {
            return split(size() - 1)._1();
        } else {
            throw new IndexOutOfBoundsException("Failed test: 0 <= index < size");
        }
    }
public RrbTree < E > without ( int index ) { if ( ( index > 0 ) && ( index < size ( ) - 1 ) ) { Tuple2 < ? extends RrbTree < E > , ? extends RrbTree < E > > s1 = split ( index ) ; Tuple2 < ? extends RrbTree < E > , ? extends RrbTree < E > > s2 = s1 . _2 ( ) . split ( 1 ) ; return s1 . _1 ( ) . join ( s2 . _2 ( ) ) ; } else if ( index == 0 ) { return split ( 1 ) . _2 ( ) ; } else if ( index == size ( ) - 1 ) { return split ( size ( ) - 1 ) . _1 ( ) ; } else { throw new IndexOutOfBoundsException ( "Failed test: 0 <= index < size" ) ; } }
Returns a new RrbTree minus the given item (all items to the right are shifted left one)
This is O(log n).
Returns a new RrbTree minus the given item ( all items to the right are shifted left one ) This is O ( log n ) .