src/main/java/org/organicdesign/fp/collections/PersistentVector.java
@SuppressWarnings("unchecked")
    private E[] leafNodeArrayFor(int i) {
        // i is the index into this vector.  Each 5 bits represent an index into an array.  The
        // highest 5 bits (that are less than the shift value) are the index into the top-level
        // array. The lowest 5 bits index the the leaf.  The guts of this method indexes into the
        // array at each level, finally indexing into the leaf node.

        if (i >= 0 && i < size) {
            if (i >= tailoff()) {
                return tail;
            }
            Node node = root;
            for (int level = shift; level > 0; level -= NODE_LENGTH_POW_2) {
                node = (Node) node.array[(i >>> level) & LOW_BITS];
            }
            return (E[]) node.array;
        }
        throw new IndexOutOfBoundsException();
    }
@SuppressWarnings("unchecked")
    private E[] leafNodeArrayFor(int i) {
        // i is the index into this vector.  Each 5 bits represent an index into an array.  The
        // highest 5 bits (that are less than the shift value) are the index into the top-level
        // array. The lowest 5 bits index the the leaf.  The guts of this method indexes into the
        // array at each level, finally indexing into the leaf node.

        if (i >= 0 && i < size) {
            if (i >= tailoff()) {
                return tail;
            }
            Node node = root;
            for (int level = shift; level > 0; level -= NODE_LENGTH_POW_2) {
                node = (Node) node.array[(i >>> level) & LOW_BITS];
            }
            return (E[]) node.array;
        }
        throw new IndexOutOfBoundsException();
    }
@ SuppressWarnings ( "unchecked" ) private E [ ] leafNodeArrayFor ( int i ) { // i is the index into this vector.  Each 5 bits represent an index into an array.  The // highest 5 bits (that are less than the shift value) are the index into the top-level // array. The lowest 5 bits index the the leaf.  The guts of this method indexes into the // array at each level, finally indexing into the leaf node. if ( i >= 0 && i < size ) { if ( i >= tailoff ( ) ) { return tail ; } Node node = root ; for ( int level = shift ; level > 0 ; level -= NODE_LENGTH_POW_2 ) { node = ( Node ) node . array [ ( i >>> level ) & LOW_BITS ] ; } return ( E [ ] ) node . array ; } throw new IndexOutOfBoundsException ( ) ; }
Returns the array (of type E) from the leaf node indicated by the given index.
Returns the array ( of type E ) from the leaf node indicated by the given index .