public Object put(final Object key, final Object value) {
	// Makes sure the key is not already in the HashMap.
	Entry tab[] = this.table;
        int hash = 0;
        int index = 0;

        if (key != null) {
            hash = key.hashCode();
            index = (hash & 0x7FFFFFFF) % tab.length;
            for (Entry e = tab[index] ; e != null ; e = e.next) {
                if (e.hash == hash && key.equals(e.key)) {
                    final Object old = e.value;
                    e.value = value;
                    return old;
                }
            }
        } else {
            for (Entry e = tab[0] ; e != null ; e = e.next) {
                if (e.key == null) {
                    final Object old = e.value;
                    e.value = value;
                    return old;
                }
            }
        }

	this.modCount++;
	if (this.count >= this.threshold) {
	    // Rehash the table if the threshold is exceeded
	    this.rehash();

            tab = this.table;
            index = (hash & 0x7FFFFFFF) % tab.length;
	}

	// Creates the new entry.
	final Entry e = new Entry(hash, key, value, tab[index]);
	tab[index] = e;
	this.count++;
	return null;
    }