posted 17 years ago
I think this is becuase the Hashtable,HashMap and LinkedHashMap all have one thing common.

The hashCode and equals functions are used to find a key.Given a key value the time taken to compute the hashCode would be the same for any key value.

In case of add, it computes the hashCode of the key to be added and lands up in a say bucket, does equals comparision with the keys in the bucket , replaces oldkey's value with newkey's value the same key is found and adds key if no key is found..

In case of contains it computes the hashCode of the key to be searched and lands up in a bucket, does equals comparision with the keys in the bucket and the input key and returns true or false.

In case of remove too, it computes the hashCode of the key to be searched and lands up in a bucket, does equals comparision with the keys in the bucket and the input key and removes the key value if found.

So all in all the hash computing time is constant, landing up in a bucket time is constant, the doing equals comparision within a bucket might vary depending on how efficient the hash algorithm is but generally

the time for all this operations can be considered constant.