static Object [ ] rebuildHashTable ( int newTableSize , Object [ ] elements , int n ) { Object [ ] hashTable = new Object [ newTableSize ] ; int mask = hashTable . length - 1 ; for ( int i = 0 ; i < n ; i ++ ) { Object e = elements [ i ] ; int j0 = Hashing . smear ( e . hashCode ( ) ) ; for ( int j = j0 ; ; j ++ ) { int index = j & mask ; if ( hashTable [ index ] == null ) { hashTable [ index ] = e ; break ; } } } return hashTable ; }
Builds a new open - addressed hash table from the first n objects in elements .