title: Java ArrayList to Kotlin Array
body: <p>Is there a simple way of converting a Java ArrayList to a Kotlin Array? The following code:</p>
  
  <pre><code>fun test(): Array&lt;String&gt; {
    val elems = ArrayList&lt;String&gt;()
    return elems.toArray()
  }
  </code></pre>
  
  <p>gives the error:</p>
  
  <pre><code>main.kt:2:15: error: unresolved reference: ArrayList
    val elems = ArrayList&lt;String&gt;()
                ^
  </code></pre>
  
  <p>I'm parsing some JSON and don't know how many elements I'm going to end up with, but once I've read them I don't need to modify the data in any way so I thought I'd go with Kotlin arrays as the data type.</p>