boon/src/main/java/org/boon/Lists.java
private static <T> int calculateIndex( List<T> list, int originalIndex ) {
        final int length = list.size();

        int index = originalIndex;

        /* Adjust for reading from the right as in
        -1 reads the 4th element if the length is 5
         */
        if ( index < 0 ) {
            index = ( length + index );
        }


        /* Bounds check
            if it is still less than 0, then they
            have an negative index that is greater than length
         */
        if ( index < 0 ) {
            index = 0;
        }
        if ( index > length ) {
            index = length;
        }
        return index;
    }
private static <T> int calculateIndex( List<T> list, int originalIndex ) {
        final int length = list.size();

        int index = originalIndex;

        /* Adjust for reading from the right as in
        -1 reads the 4th element if the length is 5
         */
        if ( index < 0 ) {
            index = ( length + index );
        }


        /* Bounds check
            if it is still less than 0, then they
            have an negative index that is greater than length
         */
        if ( index < 0 ) {
            index = 0;
        }
        if ( index > length ) {
            index = length;
        }
        return index;
    }
private static < T > int calculateIndex ( List < T > list , int originalIndex ) { final int length = list . size ( ) ; int index = originalIndex ; /* Adjust for reading from the right as in
        -1 reads the 4th element if the length is 5
         */ if ( index < 0 ) { index = ( length + index ) ; } /* Bounds check
            if it is still less than 0, then they
            have an negative index that is greater than length
         */ if ( index < 0 ) { index = 0 ; } if ( index > length ) { index = length ; } return index ; }
/* End universal methods.
/ * End universal methods .