private Node<K,V> findPredecessorOfLast(){
  for (; ; ) {
    Index<K,V> q=head;
    for (; ; ) {
      Index<K,V> d, r;
      if ((r=q.right) != null) {
        if (r.indexesDeletedNode()) {
          q.unlink(r);
          break;
        }
        if (r.node.next != null) {
          q=r;
          continue;
        }
      }
      if ((d=q.down) != null)       q=d;
 else       return q.node;
    }
  }
}

private Node < K , V > findPredecessorOfLast ( ) { for ( ; ; ) { Index < K , V > q = head ; for ( ; ; ) { Index < K , V > d , r ; if ( ( r = q . right ) != null ) { if ( r . indexesDeletedNode ( ) ) { q . unlink ( r ) ; break ; } if ( r . node . next != null ) { q = r ; continue ; } } if ( ( d = q . down ) != null ) q = d ; else return q . node ; } } }
specialized variant of findpredecessor to get predecessor of last valid node . needed when removing the last entry . it is possible that all successors of returned node will have been deleted upon return , in which case this method can be retried .
