title: java.util.Iterator to Scala list?
body: <p>I have the following code:</p>
  
  <pre><code>private lazy val keys: List[String] = obj.getKeys().asScala.toList
  </code></pre>
  
  <p><code>obj.getKeys</code> returns a <code>java.util.Iterator&lt;java.lang.String&gt;</code></p>
  
  <p>Calling <code>asScala</code>, via <code>JavaConverers</code> (which is imported) according to the docs.. </p>
  
  <pre><code>java.util.Iterator &lt;==&gt; scala.collection.Iterator 
  </code></pre>
  
  <p><code>scala.collection.Iterator</code> defines</p>
  
  <pre><code>def toList: List[A] 
  </code></pre>
  
  <p>So based on this I believed this should work, however here is the compilation error:</p>
  
  <pre><code>[scalac]  &lt;file&gt;.scala:11: error: type mismatch;
  [scalac]  found   : List[?0] where type ?0
  [scalac]  required: List[String]
  [scalac]  private lazy val keys : List[String] = obj.getKeys().asScala.toList
  [scalac]  one error found
  </code></pre>
  
  <p>I understand the type parameter or the java Iterator is a Java String, and that I am trying to create a list of Scala strings, but (perhaps naively) thought that there would be an implicit conversion.</p>