class SimpleHashtable implements Iterable<TableEntry<K, V>> {

	public void put(K key, V value) {
		Objects.requireNonNull(key, "Key cannot be null.");

		if (slotIsEmpty(key)) { // If the slot is empty, we know it doesn't contain the specified key
			table[getSlotFromKey(key)] = new TableEntry<>(key, value);
			++size;
			modificationCount++;
		}
		else {
			TableEntry<K, V> entry = findKey(key);

			if (entry.key.equals(key)) { // Update the entry's value if we found an entry with the specified key
				entry.value = value;
			}
			else { // Add a new entry if we haven't found such an entry
				entry.next = new TableEntry<>(key, value);
				++size;
				modificationCount++;
			}
		}

		doubleIfNecessary();
	}

	public  SimpleHashtable();
	@SuppressWarnings("unchecked") public  SimpleHashtable(int capacity);

}