This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hashtable in java

 
vijayapriya thirumurugan
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hello sir,

I have hashtable consists of keys with their corresponding values. While entering the values in hashtable it's in ascending order. but in printing statement the hashtable comes in descending order. I used Enumeration to print the values. What's the mechanism behind that. can you explain me. Because i need in ascending order only. i'm waiting..
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hashtable and HashMap don't keep order at all. If you need order you should check out TreeMap (user defined order based on the keys) or LinkedHashMap (order based on insertion order / access order).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic