Hashtables are a type data structure. It use a key (Object) from which you get an integer using an hashCode. Using this integer you can access the cell in the array in which the element your are searching for is located (the one associated with the key).

Another example of data structure is a list. The advantage of an hashTable over a list is that with an hashTable you find an specific element in your datastruture with an average worse case scenario of 1 ( O(1) ). With a list of n elements the worse case scenario is n (O (n) ).

So the hashTable is a lot faster and your program will run faster.

01-03-2009, 02:13 PM

Fubarable

Though I find that I rarely use HashTable and instead use the more recently created HashMap instead.

01-03-2009, 06:06 PM

Eranga

Thread starter edit his original post. It's not a good thing here, other members can confused on it.

Personally I use HashTable most of the time. Reason is, as Gudradain says, referring the elements using hashcode is much useful to me in most of projects.