@ SuppressWarnings ( "unchecked" ) Entry < K , V > removeMapping ( Object o ) { if ( ! ( o instanceof Map . Entry ) ) return null ; Map . Entry < K , V > entry = ( Map . Entry < K , V > ) o ; Object k = maskNull ( entry . getKey ( ) ) ; int hash = hash ( k ) ; int i = indexFor ( hash , table . length ) ; Entry < K , V > prev = table [ i ] ; Entry < K , V > e = prev ; while ( e != null ) { Entry < K , V > next = e . next ; if ( e . hash == hash && validEntry ( e ) && e . equals ( entry ) ) { if ( auto_commit ) { modCount ++ ; size -- ; if ( prev == e ) table [ i ] = next ; else prev . next = next ; } else e . setStatus ( Entry . DELETED , getCurrentThreadId ( ) ) ; return e ; } prev = e ; e = next ; } return e ; }
Special version of remove for EntrySet .