code: @SuppressWarnings("unchecked")
    public void setCapacity(int newCapacity) {
      if (newCapacity > _capacity) { // Capacity increases.
        for (int i = _capacity; i < newCapacity; i++) {
          EntryImpl<K, V> entry = new EntryImpl<K, V>();
          entry._after = _poolFirst;
          _poolFirst = entry;
        }
      } else if (newCapacity < _capacity) { // Capacity decreases.
        for (int i = newCapacity; (i < _capacity) && (_poolFirst != null); i++) {
          // Disconnects the entry for gc to do its work.
          EntryImpl<K, V> entry = _poolFirst;
          _poolFirst = entry._after;
          entry._after = null; // All pointers are now null!
        }
      }
      // Find a power of 2 >= capacity
      int tableLength = 16;
      while (tableLength < newCapacity) {
        tableLength <<= 1;
      }
      // Checks if the hash table has to be re-sized.
      if (_entries.length != tableLength) {
        _entries = new EntryImpl[tableLength];
        _mask = tableLength - 1;
  
        // Repopulates the hash table.
        EntryImpl<K, V> entry = _mapFirst;
        while (entry != null) {
          int index = keyHash(entry._key) & _mask;
          entry._index = index;
  
          // Connects to bucket.
          entry._previous = null; // Resets previous.
          EntryImpl<K, V> next = _entries[index];
          entry._next = next;
          if (next != null) {
            next._previous = entry;
          }
          _entries[index] = entry;
  
          entry = entry._after;
        }
      }
      _capacity = newCapacity;
    }
docs: Changes the current capacity of this {@link FastMap}. If the capacity
  is increased, new entries are allocated and added to the pool.
  If the capacity is decreased, entries from the pool are deallocated
  (and are eventually garbage collected). The capacity also determined
  the number of buckets for the hash table.
  
  @param newCapacity the new capacity of this map.