title: Returning same collection type, differently parameterised
body: <p>Daniel Sobral showed how we can create a method that returns the same collection type upon which it was called in his answer to this question: <a href="https://stackoverflow.com/q/8235462/770361">Returning original collection type in generic method</a></p>
  
  <p>Is it possible to do the same for a method that uses a mapping to return a differently-parameterized version of the same collection type?</p>
  
  <p>For example</p>
  
  <pre><code>def foo[A](xs: GenTraversable[A]) = xs map (_.toString)
  </code></pre>
  
  <p><code>foo( List(1, 2, 3) )</code> returns <code>res: GenTraversable[String] = List(1, 2, 3)</code></p>
  
  <p>Can this be adapted so that</p>
  
  <p><code>foo( Set(1, 2, 3) )</code> returns a <code>Set[String]</code></p>
  
  <p><code>foo( List(1, 2, 3) )</code> returns a <code>List[String]</code></p>
  
  <p><code>foo( Vector(1, 2, 3) )</code> returns a <code>Vector[String]</code></p>