lunduniversity / introprog

Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
142 stars 177 forks source link

Fix slide on deepEquals on nested arrays slides w08 #843

Open bjornregnell opened 1 day ago

bjornregnell commented 1 day ago

Make extra slide with conrete example of deepEquals where arrays are cast to Array[Object]

bjornregnell commented 1 day ago

Show also Object.deepEquals https://stackoverflow.com/questions/63686721/best-replacement-of-deep-method-in-scala-2-13

bjornregnell commented 1 day ago
scala> java.util.Arrays.deepEquals(
     |   Array(Array("a", Array("b"))).asInstanceOf[Array[Object]],
     |   Array(Array("a", Array("b"))).asInstanceOf[Array[Object]])
val res9: Boolean = true

scala> java.util.Objects.deepEquals(
     |   Array(Array("a", Array("b"))),
     |   Array(Array("a", Array("b"))))
val res10: Boolean = true