Hashtable problem
2 posts in topic
Flat View  Flat View

Posted By:   sudhakar_chavali
Posted On:   Tuesday, July 24, 2001 07:59 AM


I have one problem using the Hastable.
The problem is some thing like this.

Dynamically (user's reuqest form) i am putting the data into the hashtable and maintaining the hashtable object in session.

Using Enumerator object if i try to fetch the total information of hastable, enumerator is giving the information randomly instead of showing info as FIFO(First in First Out) way.What could be the problem?How to rectify the problem?Are there any other solutions?


Sudhakar Chavali

Re: Hashtable problem

Posted By:   John_Zukowski  
Posted On:   Tuesday, July 24, 2001 08:13 AM

Re: Hashtable problem

Posted By:   Christopher_Schultz  
Posted On:   Tuesday, July 24, 2001 08:07 AM

This is happening because Hashtable isn't FIFO, like you think it is.

A hashtable stores it's elements in an apparent random order. (Of course, that's not true, but it doesn't look like it makes any sense when you're enumerating through them).

You'll want to use a class that keeps it's elements ordered, like a List such as ArrayList. Then, your elements will come out in the same order that you put them in.

About | Sitemap | Contact