Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to sort a Map with Enums

 
vuthlarhi donald
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iwant to sort the map, so that when I print the result's ...everything must be sorted with aphabetical order, with the ordinal values as well. so I can't use a TreeMap, because that will only sort the values of the enums/ordinal values...I am running out of ideas..help.



 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a TreeMap and provide a Comparator<Titles> or perhaps even a Comparator<Enum><?>> to the constructor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic