public void testValueSetHashTableExpansion() {
   LinkedHashMultimap<String, Integer> multimap = LinkedHashMultimap.create();
   for (int z = 1; z <= 100; z++) {
     multimap.put("a", z);
     // The Eclipse compiler (and hence GWT) rejects a parameterized cast.
     @SuppressWarnings("unchecked")
     LinkedHashMultimap<String, Integer>.ValueSet valueSet =
         (LinkedHashMultimap.ValueSet) multimap.backingMap().get("a");
     assertEquals(z, valueSet.size());
     assertFalse(
         Hashing.needsResizing(
             valueSet.size(),
             valueSet.hashTable.length,
             LinkedHashMultimap.VALUE_SET_LOAD_FACTOR));
   }
 }
Example #2
0
 private void rehashIfNecessary()
 {
   BiEntry[] arrayOfBiEntry = this.hashTableKToV;
   if (Hashing.needsResizing(this.size, arrayOfBiEntry.length, 1.0D))
   {
     int i = 2 * arrayOfBiEntry.length;
     this.hashTableKToV = createTable(i);
     this.hashTableVToK = createTable(i);
     this.mask = (i - 1);
     this.size = 0;
     for (int j = 0; j < arrayOfBiEntry.length; j++)
     {
       BiEntry localBiEntry;
       for (Object localObject = arrayOfBiEntry[j]; localObject != null; localObject = localBiEntry)
       {
         localBiEntry = ((BiEntry)localObject).nextInKToVBucket;
         insert((BiEntry)localObject);
       }
     }
     this.modCount = (1 + this.modCount);
   }
 }