I have the following code....

```
public Map<Object, Integer> getRankings(){
    Stream<String> stream = votes.stream();
    return stream
            .collect(Collectors.toMap(s -> s, s -> 1, Integer::sum));
}

```

This works great but now I want to sort the map based on count. I tried a sort after the collect but the method isn't available because the stream is now a map. How would I sort this before returning it? Can I do it using a Stream or do I have to sort as a map?