4 ms·
It is likely because equals is usually “object equals”, not necessarily “math equals”. Since the internal representation is different, the objects are indeed d
by cowanon55 2y ago
It is likely because equals is usually “object equals”, not necessarily “math equals”. Since the internal representation is different, the objects are indeed different. Tricky though, and most 3rd party code would likely choose to make equals true in this kind of situation.
Java has tons of examples where the core behavior is logically correct, but VERY unintuitive - I feel the pain daily.
- ktm5j 2y agoI don't think that flies, because the whole point of the .equals() method in regards to string is to avoid "object equals" and make sure the strings say the same thing..