java - Sort Map By Value Object Member -


this question has answer here:

i have generic map defined thus

map<integer, book> bookcollection 

the integer book id , book book object. book object has member called publicationyear.

how sort map book objects in order book's publicationyear member. so, if iterate through sorted map, oldest book appears first newest book.

at moment, map randomly sorted.

the publicationyear has part of key. sort based on that.


Comments

Popular posts from this blog

android - Automated my builds -

ruby on rails - Difference between "Redmine on Heroku" and "Installing Redmine" documentation -

c# - Create a custom control in Corel Draw X6 using only VSTA -