aspose 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: 14435
    
  23

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 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hashtable