Hacker News new | past | comments | ask | show | jobs | submit | cowanon55's comments login

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.


I 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..


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: