Node < E > predecessor ( ) { Node < E > n = this ; for ( ; ; ) { Node < E > b = n . getPrev ( ) ; if ( b == null ) return n . findPredecessorOf ( this ) ; Node < E > s = b . getNext ( ) ; if ( s == this ) return b ; if ( s == null || ! s . isMarker ( ) ) { Node < E > p = b . findPredecessorOf ( this ) ; if ( p != null ) return p ; } n = b ; } }
Returns the previous non - deleted node patching up pointers as needed . Returns null if this node is header so has no successor . May also return null if this node is deleted so doesn t have a distinct predecessor .