Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If one has two immutable objects which define <code>Equals</code> to return true when every field in one object reports itself <code>Equal</code> to the corresponding field in the other, and if none of the code which uses the objects cares about reference equality, then it should be possible to replace all references to one object with references to the other. If the objects are generated by e.g. parsing data read from disk, and if many objects will compare equal, replacing many different instances with references to one instance may improve performance greatly. Note that the correctness of such substitution does not depend upon whether the objects are shallowly or deeply immutable, provided only that any mutable objects nested within them will report themselves as unequal to anything other than themselves.</p> <p>For such logic to work correctly, it's important that the objects in question be fully equivalent. Every object is required to be equal to itself, so <code>Double.NaN</code> must equal <code>Double.NaN</code>. The requirement for full equivalence implies that positive zero must not report itself equal to negative zero (since if it did, an object which holds a positive zero might behave differently from one holding negative zero).</p> <p>Note, btw, that this is an area where .net differs from Java (some non-equivalent floating-point and <code>Decimal</code> values are report <code>Equals</code>); in many ways, I think .net is superior, but this detail is one that .net got wrong.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload