• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sortable Map  RSS feed

 
baukien kzaza
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yesterday I was using a HashMap, and I wanted a quick snippet of code that allowed me to sort the map by either it's keys or values. I've only scratched the surface of all the java Collections classes, so I don't know if this already exists, but I present a sortable map!




This is just a snippet that I wrote for my own uses, and thought I should post it just in case anybody else has an interest Smiley
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

SortedMap would appear to exist already, however. You would do well to try one of the classes implementing that interface.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!