public int remove ( int index ) { if ( index < 0 || index >= size ) { throw new IndexOutOfBoundsException ( String . valueOf ( index ) ) ; } int old = get ( index ) ; if ( index == 0 ) { // data at the front System . arraycopy ( data , 1 , data , 0 , size - 1 ) ; } else if ( size - 1 == index ) { // no copy to make, decrementing pos "deletes" values at // the end } else { // data in the middle System . arraycopy ( data , index + 1 , data , index , size - ( index + 1 ) ) ; } size -- ; return old ; }
Removes the value at specified index from the list .