If you have been using a HashMap and discover you also need the pairs in sorted order, you may have disovered the code you need is rather convoluted. Instead use a SortedMap interface e.g. TreeMap which gives you both the Map lookup and the sorted set. TreeMap maintains all the keys in order at all times which usually takes more overhead that sorting the keys once at the end as you would do exporting a HashMap.
|
|
You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) |
| http://mindprod.com/jgloss/sortedmap.html | J:\mindprod\jgloss\sortedmap.html | |
![]() | Please email your feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording,
broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.179.212] | |
| Feedback | You are visitor number 1. | |