+ 2

structural equality kotlin

what are some examples of structural equality

27th Dec 2019, 5:42 PM
voyes
voyes - avatar
1 Réponse
0
Classes contain data properties. They also can define a comparison method. The method would look at the properties to decide that the data is the same. Passing the test as equal defines equality. It does not mean all properties have the same values as there could be maintenance properties that are not compared. An example using the Int class: val one = 1 if (one == 1) print("structural equality")
27th Dec 2019, 7:52 PM
John Wells
John Wells - avatar