title: Kotlin - Convert Collection to Array List
body: <p>I'm converting a Java application to Kotlin.
  In one area it's using apache IO's FileUtils listFiles functions.</p>
  
  <p>These return collections and I'm having problems converting/casting the collections into ArrayList</p>
  
  <pre><code>        val myFiles = FileUtils.listFiles(mediaStorageDir, extensions, true) as ArrayList&lt;File&gt;
  </code></pre>
  
  <p>Whilst this compiles I get a runtime error as follows:</p>
  
  <blockquote>
    <p>java.util.LinkedList cannot be cast to java.util.ArrayList</p>
  </blockquote>
  
  <p>What's the correct way to convert a collection object into an ArrayList?</p>