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 -

apache - GeoServer under https -

php - Iterate over object properties with keys from second array -