---
title: "Discussion on \"Sort a Map based on its value in Java\" | Hashnode"
description: "Discussion on \"Sort a Map based on its value in Java\". Suppose there is a map with values : {a=5 , z=6 , b=12} and you want to sort based on its values as {b=12 , z=6 , a=5} (descending order)\n\nNow if we want to sort the map based on values of map entry then we need to use PriorityQueue class. And here w..."
url: "https://hashnode.com/posts/sort-a-map-based-on-its-value-in-java/62ced44ac88cd0d5ff701acc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sort a Map based on its value in Java](https://nisabmohd.hashnode.dev/sort-a-map-based-on-its-value-in-java?utm_source=hashnode&utm_medium=feed)

Suppose there is a map with values : {a=5 , z=6 , b=12} and you want to sort based on its values as {b=12 , z=6 , a=5} (descending order) Now if we want to sort the map based on values of map entry then we need to use PriorityQueue class. And here w...

Jul 13, 2022 · 1 min read · nisabmohd.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#sorting](https://hashnode.com/tag/sorting)
-   [#map](https://hashnode.com/tag/map)

## Written by

[Mohd Nisab Alam](https://hashnode.com/@nisabmohd)

@nisabmohd · India

  
[View profile](https://hashnode.com/@nisabmohd)

Software Engineer

Hello, fellow &lt;𝙙𝙚𝙫𝙚𝙡𝙤𝙥𝙚𝙧𝙨/&gt;! Hi, I'm Nisab, A Full-Stack Web Developer, a begginer Android developer and a Competitive Programming Enthusiast , who is obsessed with the idea of improving himself and wants a platform to grow and excel .

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
