File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Hashtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Hashtable" Watch "Hashtable" New topic
Author

Hashtable

suman deb
Ranch Hand

Joined: Jul 14, 2005
Posts: 54
By default, Hashtable is unordered. Then, how can you retrieve Hashtable elements in the same order as they are put inside?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

If you really want to do this with Hashtable, you'd have to implement a mechanism yourself to remember the order in which the entries were inserted into the Hashtable.

But you'd better use LinkedHashMap, which already does this for you. Look it up in the API documentation.
[ August 23, 2005: Message edited by: Jesper de Jong ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hashtable
 
Similar Threads
Hashtables are synchronized...
HashMap or HashTable
Collections
Collection- Fast Retrieval
Hashtable casting error