The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2001

Advertisement

Advertisement
where you can ask and answer Java programming questions.">
artima.com - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 


Java Answers Forum
February 2001

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:

When to choose Hashtables and Arrays

Posted by Kumar on February 14, 2001 at 11:18 PM

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:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us