...
Wiki Markup |
---|
*EXP03:* In general, for any two objects, it is permissible to compare their elements provided that the class is a singleton. The use of static factory methods over constructors facilitates instance control which in turn limits the effective number of instances of an immutable class to one. As a result, for two objects {{a}} and {{b}}, {{a.equals(b)}} is {{true}} when {{a==b}} \[[Bloch 08|AA. Java References#Bloch 08]\]. The {{String}} class does not meet these requirements and consequently, does not possess these characteristics. |
...