title: How to copy a two-dimensional array in Kotlin?
body: <p>This method works fine.  However, I think it is not functional.  </p>
  
  <pre><code>fun getCopy(array: Array&lt;BooleanArray&gt;): Array&lt;BooleanArray&gt; {
      val copy = Array(array.size) { BooleanArray(array[0].size) { false } }
      for (i in array.indices) {
          for (j in array[i].indices) {
              copy[i][j] = array[i][j]
          }
      }
      return copy
  }
  </code></pre>
  
  <p>Is there a more functional way?</p>