Scala

Scala

By DeepSource

Using .deep to compare Arrays is deprecated SC-W1051

Bug risk

Comparing two Arrays using .deep is deprecated and is not supported beyond Scala version 2.12. To avoid compilation errors when moving to version 2.13 and above, consider switching to a more well supported alternative.

Bad practice

val a = Array(1, 2, 3)
val b = Array(1, 2)

val arraysEqual = a.deep == b.deep

Recommended

val a = Array(1, 2, 3)
val b = Array(1, 2)

a.sameElements(b)               // The native Scala approach
java.util.Arrays.equals(a, b)   // The usual Java way