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

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -