+ 5
how can we do sorting in Map in Java ??
3 Respostas
+ 9
Additionally to Boem Shakalaka 's answer you could:
1. Use a sorted map/tree map
2. Stream the map and sort it by using a comparator (if you want to define your own order and not the natural order that is implemented in the api)
Note that a hashmap is defined as unordered.
+ 1
https://code.sololearn.com/ctkvfjd6P3z0/?ref=app
study this code