private E dequeue ( ) { // assert takeLock.isHeldByCurrentThread(); // assert head.item == null; Node < E > h = head ; Node < E > first = h . next ; h . next = sentinel ( ) ; // help GC head = first ; E x = first . item ; first . item = null ; return x ; }
Removes a node from head of queue .