Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

Hash table

Thread view: 
Rajesh.Rapaka - 26 Jul 2006 10:46 GMT
Hi,

I am using Hash table for a part of my program. where I am haing index
& values.

Till now I am giving indexes to get values.

but now I want to know what indexes are present in the hash table.

is there a method with which i can get a list of the indexes available
in the hash table.

thanks in advance.
Rajesh Rapaka.
Bart Cremers - 26 Jul 2006 10:57 GMT
Rajesh.Rapaka schreef:

> Hi,
>
[quoted text clipped - 10 lines]
> thanks in advance.
> Rajesh Rapaka.

Set keySet = Hashtable.keySet();

Regards,

Bart
Matt Humphrey - 26 Jul 2006 13:20 GMT
> Rajesh.Rapaka schreef:
>
[quoted text clipped - 14 lines]
>
> Set keySet = Hashtable.keySet();

In addition Rajesh, if you don't have a copy of the API documentation, get
it from http://java.sun.com/javase/downloads/index.jsp It's the first place
to look for answers to questions like this.

Cheers,
Matt Humphrey  matth@ivizNOSPAM.com http://www.iviz.com/
Rajesh.Rapaka - 26 Jul 2006 14:23 GMT
> Set keySet = Hashtable.keySet();
>
> Regards,
>
> Bart

Hi,

I guess according the algorithm of Hashtable, the key values are
shuffled. is there any possibility to get the keys in the order I
added?

say I added 1,2,3, & 4. But when I ask for key values I get 2,4,3 & 1.
Is there a posssiblity that i can get it as 1,2,3&4.

Thank you,

regards,
Rajesh Rapaka.
Bart Cremers - 26 Jul 2006 15:09 GMT
Rajesh.Rapaka schreef:

> I guess according the algorithm of Hashtable, the key values are
> shuffled. is there any possibility to get the keys in the order I
[quoted text clipped - 7 lines]
> regards,
> Rajesh Rapaka.

Not with a Hashtable. You'll need to use a LinkedHashMap to get that
behavior. Note that LinkedHashMap was only add to Java since v1.4.

Regards,

Bart


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.