title: How do I use Java stream collect to create a map with a String as the key instead of object?
body: <p>I have the following...</p>
  <pre><code>public Map&lt;Object, Integer&gt; getRankings(){
      Stream&lt;String&gt; stream = votes.stream();
      Map&lt;Object, Integer&gt; map = stream
              .collect(Collectors.toMap(s -&gt; s, s -&gt; 1, Integer::sum));
      return Vote.sortByValues(map);
  }
  </code></pre>
  <p>But I would like the return type to be <code>Map&lt;String, Integer&gt;</code> instead. How do I coerce the <code>Object</code> to a <code>String</code>?</p>