private void resize ( ) { Entry [ ] oldTab = table ; int oldLen = oldTab . length ; int newLen = oldLen * 2 ; Entry [ ] newTab = new Entry [ newLen ] ; int count = 0 ; for ( int j = 0 ; j < oldLen ; ++ j ) { Entry e = oldTab [ j ] ; if ( e != null ) { int h = e . key . hashCode & ( newLen - 1 ) ; while ( newTab [ h ] != null ) h = nextIndex ( h , newLen ) ; newTab [ h ] = e ; count ++ ; } } setThreshold ( newLen ) ; size = count ; table = newTab ; }
Double the capacity of the table .