Kotlin returns 2d Array property as reference
I was messing around with Kotlin and 2d arrays an I detected a strange behavior that I don't understand.
So I have a Class that has a 2d Array as property and I have another class that takes that Array and change it. But now the original Array from the property has changed.
My code looks like that
import org.junit.Test
class ClassHasArray {
val someArray = Array(3) { BooleanArray(3) }
}
class ClassWantsArray {
@Test
fun test(){
val c = ClassHasArray()
val arr =...