Stephan van Hulst wrote:No, you can't sort maps by value (or any property of the value).
You can convert the map to a list of entries though, and sort that based on the values of the entries.
salman khandu wrote:
How can I achieve it? I have done with that but it doesn't sort by length.
Yes, you can.Ekrem Candemir wrote:I don't know whether we can share link from other sites . . .
Why would you want to do that? If you work out what you are going to do, you may be able to find a more elegant way to achieve it.salman khandu wrote:How can I achieve it?
There are three kinds of actuaries: those who can count, and those who can't.
Ekrem Candemir wrote:I don't know whether we can share link from other sites, If we can't do that, I'm sorry.
You should check out these links: link1 and link2.
Hope this helps!
SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace