final Node < K , V > removeNode ( int hash , Object key , Object value , boolean matchValue , boolean movable ) { Node < K , V > [ ] tab ; Node < K , V > p ; int n , index ; if ( ( tab = table ) != null && ( n = tab . length ) > 0 && ( p = tab [ index = ( n - 1 ) & hash ] ) != null ) { Node < K , V > node = null , e ; K k ; V v ; if ( p . hash == hash && ( ( k = p . key ) == key || ( key != null && key . equals ( k ) ) ) ) node = p ; else if ( ( e = p . next ) != null ) { if ( p instanceof TreeNode ) node = ( ( TreeNode < K , V > ) p ) . getTreeNode ( hash , key ) ; else { do { if ( e . hash == hash && ( ( k = e . key ) == key || ( key != null && key . equals ( k ) ) ) ) { node = e ; break ; } p = e ; } while ( ( e = e . next ) != null ) ; } } if ( node != null && ( ! matchValue || ( v = node . value ) == value || ( value != null && value . equals ( v ) ) ) ) { if ( node instanceof TreeNode ) ( ( TreeNode < K , V > ) node ) . removeTreeNode ( this , tab , movable ) ; else if ( node == p ) tab [ index ] = node . next ; else p . next = node . next ; ++ modCount ; -- size ; afterNodeRemoval ( node ) ; return node ; } } return null ; }
Implements Map . remove and related methods