Counting word frequencies, grouping students by branch or caching results all need a lookup from a key to a value. A Map gives that lookup in O(1) average with HashMap, which is why it appears in a huge share of coding answers. Reach for TreeMap when keys must stay sorted or you need floor and ceiling queries. When there is no value attached, only the key, a Set is the simpler tool.