package c import java.util.ArrayList fun Array.toIntArray(): IntArray = this.mapTo(IntArray(size), {it}) fun Array.toArrayList(): ArrayList = this.mapTo(ArrayList(size), {it}) public fun > Array.mapTo(result: C, transform : (T) -> R) : C = throw Exception("$result $transform")