public Object removeTail ( ) { if ( last == null ) throw new IllegalArgumentException ( "Empty list" ) ; Object ret = last . getObject ( ) ; Element < T > e = last ; available . add ( last ) ; if ( last . previous != null ) { last . previous . next = null ; last = last . previous ; } else { // there's only one element in the list first = last = null ; } e . clear ( ) ; size -- ; return ret ; }
Removes the last element from the list