title: Java collect() Stream with generic type
body: <p>Is there way to <code>collect()</code> generic items from a <code>stream</code> ?</p>
  
  <p>This is what I want to do...</p>
  
  <pre><code>private &lt;T extends Data&gt; List&lt;Response&lt;T&gt;&gt; validateAndGetResponses(List&lt;Response&gt; responses, Class&lt;T&gt; clazz) {
          Supplier&lt;List&lt;Response&lt;T&gt;&gt;&gt; supplier = LinkedList::new;
  
          List&lt;Response&lt;T&gt;&gt; list = responses.stream().filter(
                  response -&gt; clazz.isInstance(getData(response))).collect(Collectors.toCollection(supplier));
          return list;
  
  }
  </code></pre>
  
  <p>This doesn't work, I get </p>
  
  <p><code>no suitable method found for collect(....)</code></p>