peterholak
11/13/2018, 2:18 PMigor.wojda
11/13/2018, 2:46 PMEffective Java equality guidelines, so equals the implementation it is already optimised. Under the hood object compression works more or less like this:
1. Check if object is the same (current vs object passed as argument)
2. Check hashCode (if equal go to step 3)
3. Check if values all hashCodes of properties declared in the primary constructor are equalpeterholak
11/13/2018, 2:49 PMcbruegg
11/13/2018, 3:11 PMX.kt. As you can see, the lists are not compared by identity first, but equals is callled directly after a null-check. However, most List implementations in the JDK actually extend AbstractList, which performs the reference identity check in its equals implementation: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/util/AbstractList.java#l512