Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Treemap key sort
Raj Ohadi
Ranch Hand
Posts: 316
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If I use java.util.Date as the "key" for a TreeMap. When I add objects, does TreeMap automatically sort the "key" by ascendant order of "Date" ?
Stephan van Hulst
Saloon Keeper
Posts: 15491
363
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Depends on the constructor you used. What does the Javadoc for TreeMap say?
santosh joshi
Greenhorn
Posts: 21
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The java.util.Date class implements the Comparable interface. so even if you use the default TreeMap constructor then on putting the java.util.Date as Key the TreeMap will automatically sort by asc order of date
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
More than a sorting with dupplicate elimination
Treemap sort based on Value.. is it possible?
[Solved] HashMap, Which thing defines the order of elements
sorting a TreeMap
Hashtable iterator question
More...