you can use the Enumeration class for iterating thru all the elements in the Hashtable
Something like this :
Enumeration e = hashtable.keys();
while(e.hasMoreElements())
{
objecttype obj = (objecttype)hashtable.get((ObjectType)e.nextElement());
//ObjectType = the data
type of the key
//objecttype = the
data type of the value
}
This enumeration gives you all the keys in the hashtable , for accessing
all the values directly you can also say hashtable.elements() instead
of hashtable.keys().
This returns an Enumeration of al;l the elements in the hashtable
Of course you would require an appropriate cast
to get the actual object that you are storing in the Hashtable.
Hope this helps ....
Rishi.
"Cote, Stephane" wrote:
Hi all.
How do I go trought all the Objects stored in a Hashtable.
With Vector it is easy by getting the size and looping with vector.elementAt(i) but
how can I do this with a Hashtable.Thanks.
,, Stephane DeCoeli Cote
` > [EMAIL PROTECTED]
|| ~ ||
|||=oOOo=====oOOo=|||
|| \ /||\ / ||
\/ || \/
/\
