private Entry<K, V> getEntry(Object key) {
        if (size == 0) {
            return null;
        }
        int hash = key == null ? 0 : key.hashCode();
        int index = hash % table.length;
        for (Entry<K, V> entry = table[index]; entry != null; entry = entry.next) {
            if (hash == entry.hash && (key == entry.key || (key != null && key.equals(entry.getKey())))) {
                return entry;
            }
        }
        return null;
    }