nl_tokens: Returns an array size suitable for the backing array of a hash table that uses open addressing with linear probing in its implementation . The returned size is the smallest power of two that can hold setSize elements with the desired load factor . Always returns at least setSize + 2 .
pl_tokens: @ VisibleForTesting static int chooseTableSize ( int setSize ) { setSize = Math . <mask> ( setSize , 2 ) ; // Correct the size for open addressing to match desired load factor. if ( setSize < CUTOFF ) { // Round up to the next highest power of 2. int tableSize = Integer . highestOneBit ( setSize - 1 ) << 1 ; while ( tableSize * DESIRED_LOAD_FACTOR < setSize ) { tableSize <<= 1 ; } return tableSize ; } // The table can't be completely full or we'll get infinite reprobes checkArgument ( setSize < MAX_TABLE_SIZE , "collection too large" ) ; return MAX_TABLE_SIZE ; }