@Override
	public V put(K key, V value) {
		if(key==null)
			throw new NullPointerException("Keys cannot be null");
		int code=System.identityHashCode(key);
		int hash =hash(code);
		
		
		hash &=mask;
		
	
		// System.out.println(Integer.toHexString(hash)+"\t"+Integer.toHexString(hash2)+"\t"+Integer.toHexString(hash3));

		Object tk =table[hash];
		
		if (key==tk) {
			V old =(V) table[hash + 1];
			table[hash + 1] =value;
			return old;
		}
		int hash2 =hash2(code);
		hash2 &=mask;
		
		tk =table[hash2];
		
		if (key==tk) {
			V old =(V) table[hash2 + 1];
			table[hash2 + 1] =value;
			return old;
		}

		int hash3 =hash3(code);
		hash3 &=mask;
		
		tk =table[hash3];
		
		if (key==tk) {
			V old =(V) table[hash3 + 1];
			table[hash3 + 1] =value;
			return old;
		}

		tk =table[hash];
		if (tk == null) {
			table[hash] =key;
			table[hash + 1] =value;
			size++;
			return null;
		}
		tk =table[hash2];
		if (tk == null) {
			table[hash2] =key;
			table[hash2 + 1] =value;
			size++;
			return null;
		}
		tk =table[hash3];
		if (tk == null) {
			table[hash3] =key;
			table[hash3 + 1] =value;
			size++;
			return null;
		}
		// System.out.println(Integer.toHexString(hash)+"\t"+Integer.toHexString(hash2)+"\t"+Integer.toHexString(hash3));

		// fail. This is generally very rare.
		// evict key value pair...
		Object pushKey =table[hash];
		Object pushValue =table[hash + 1];
		table[hash] =key;
		table[hash + 1] =value;
		// System.out.println("Key:"+key+"\t"+hash);
		assert key!=pushKey;
		pushInsert(pushKey, pushValue);
		size++;
		if (size > threshold)
			rehash();
		return null;
	}