title: How to perform a `Collectors.toList()` correspondingly in scala
body: <p>I have the following class and method used in the code below with <code>ids</code> being a <code>Set[String]</code>:</p>
  
  <pre><code>case class PAV ()
  
  def aggregate(pId: String, iId: Option[String], count: Int): PAV
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <p>One, using <code>java.util.stream.Collectors</code></p>
  
  <pre><code>tuple._2.get.ids.toStream
    .map(i =&gt; aggregate("some", Option(i), tuple._1.data.`type`))
    .collect(Collectors.toList[PAV]) // required PartialFunction found Function0
  </code></pre>
  
  <p>Two, using <code>identity</code></p>
  
  <pre><code>tuple._2.get.ids.toStream
    .map(i =&gt; aggregate("some", Option(i), tuple._1.data.`type`))
    .collect(identity(PAV)) // required PartialFunction found PAV.type
  </code></pre>
  
  <p>I have tried the above based on <a href="https://stackoverflow.com/questions/54255632/how-do-i-use-java-8s-stream-collect-from-scala-2-11">How do I use java 8&#39;s stream collect from scala 2.11?</a> </p>
  
  <p>Curious to know, why not provide a <code>Function</code> to <code>collect</code>?</p>