private E dequeue ( ) { // assert lock.getHoldCount() == 1; // assert items[takeIndex] != null; final Object [ ] items = this . items ; @ SuppressWarnings ( "unchecked" ) E x = ( E ) items [ takeIndex ] ; items [ takeIndex ] = null ; if ( ++ takeIndex == items . length ) takeIndex = 0 ; count -- ; if ( itrs != null ) itrs . elementDequeued ( ) ; notFull . signal ( ) ; return x ; }
Extracts element at current take position advances and signals . Call only when holding lock .