final void treeifyBin ( Node < K , V > [ ] tab , int hash ) { int n , index ; Node < K , V > e ; if ( tab == null || ( n = tab . length ) < MIN_TREEIFY_CAPACITY ) resize ( ) ; else if ( ( e = tab [ index = ( n - 1 ) & hash ] ) != null ) { TreeNode < K , V > hd = null , tl = null ; do { TreeNode < K , V > p = replacementTreeNode ( e , null ) ; if ( tl == null ) hd = p ; else { p . prev = tl ; tl . next = p ; } tl = p ; } while ( ( e = e . next ) != null ) ; if ( ( tab [ index ] = hd ) != null ) hd . treeify ( tab ) ; } }
Replaces all linked nodes in bin at index for given hash unless table is too small in which case resizes instead .