This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Store Variables
Posted by Prashant on July 02, 2001 at 3:20 PM
Is it possible to use hashtables to store variables, if yes, how? thanks Prashant As I understand it from my experience in Data Structures: > The following points will help decide between Hashtables and Arrays: > 1) Order : If the order in which the individual elements are added is important, an Array needs to be used. > 2) Random access: If you require a random and quick access to individual elements, an Array can be used. > 3) Search: If you are not sure where the individual element is located in the list but need to search for it, a Hashtable will be useful. > Regards > Kumar > > Hashtable is for storing values like , combination. It is something like a [n][2] dimension array. You can use this when ever you want to retrieve a value based on a key .. like in chatting , where "user1" is in room "room" whenever you want you can get his room and change his room using the . If u still have doubt mail me so that i can send u a demo.
Replies:
|