I have a HashMap of type:
HashMap<String, HashMap<String, Integer>>
This HashMap has values like
{name, {dateasString, numberOfTasks}}
I want to sort this by numberOfTasks. I can’t find the way to do that.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t sort a
HashMap, but you can get a sorted Array (or a List) ofthe keys. How you want to define your sort is up to you – just modify the
comparator (or the
numberOfTasksfunction that it calls:)So something like this?