This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Kasun Wixkramanayake wrote:I couldnt understand what is meant by symmetry and One-way interoperability
Symmetry means that if X and Y are both non-null, then X.equals(Y) must return the same results as Y.equals(X). The CaseInsensitiveString class violates that.
It looks like "one-way interoperability" basically refers to the specific manner in which it is violating symmetry. By using that instanceof test, CaseInsensitiveString.equals(String) can be true, but String.equals(CaseInsensitiveString) can never be true.
Joined: Oct 13, 2005
Yesterday, I wrote: . . . Is that a quote from Joshua Bloch’s book? . . .
It is on page 35 in the 2nd edition of Effective Java.