Getting the Hashtable-Keys/Values in order of adding

  • Thread starter Thread starter Olaf Pokorny
  • Start date Start date
O

Olaf Pokorny

Hi,

how can I get the Hashtable-Entries in the way I´ve added them?
I am getting them always mixed .... do I need to sort it (how?)
afterward manually?

Regards,
O.P.
 
* "Olaf Pokorny said:
how can I get the Hashtable-Entries in the way I´ve added them?
I am getting them always mixed .... do I need to sort it (how?)
afterward manually?

You will have to store the items in a separate data structure like an
arraylist in order to get them in the order they were added to the
list. There is no defined order for items in a hashtable.
 
Key - value pairs are meant to be retrievable based on keys rather than
index or order in which they went in. Are you sure HashTable is the correct
collection for your siuation?

--Saurabh
 
Back
Top