How to compare two arrays in Kotlin?
<p>Given some arrays in Kotlin</p>

<pre class="lang-kotlin prettyprint-override"><code>let a = arrayOf("first", "second")
val b = arrayOf("first", "second")
val c = arrayOf("1st", "2nd")
</code></pre>

<p>Are there built-in functions to the Kotlin std-lib that tests two arrays for (value) equality for each element?</p>

<p>Thus resulting in:</p>

<pre class="lang-kotlin prettyprint-override"><code>a.equals(b) // true
a.equals(c) // false
</code></pre>

<p><code>equals()</code> is actually returning <code>false</code> in both cases, but maybe there are built-in functions to Kotlin that one could use?</p>

<p>There is the static function <code>java.utils.Arrays.deepEquals(a.toTypedArray(), b.toTypedArray())</code> but I would rather prefer an instance method as it would work better with optionals.</p>