@SuppressWarnings("unchecked")
	private void resize(){
		int oldCapacity = table.length;
		int newCapacity = 2 * oldCapacity;
		HashMap<K,V>[] oldTable = table;
		table = (HashMap<K,V>[]) new HashMap[newCapacity];
		for (int i = 0; i < newCapacity; i++){
			table[i] = new HashMap<K,V>();
		}
		largestbucketever = 0;
		for (HashMap<K,V> bucket : oldTable) {
			Iterator<Entry<K, V>> it = bucket.entrySet().iterator();
		    while (it.hasNext()) {
		        Map.Entry<K,V> pairs = it.next();

				int myBucket = hash(pairs.getKey()) % table.length;
				table[myBucket].put(pairs.getKey(), pairs.getValue()); 
				if(largestbucketever < table[myBucket].size()){
					largestbucketever = table[myBucket].size();
				}
		        it.remove(); // avoids a ConcurrentModificationException
		    }
		}
	}