npryce / maybe-java

A Maybe type for Java
http://www.growing-object-oriented-software.com
Apache License 2.0
70 stars 18 forks source link

equals looks fishy #4

Closed treeowl closed 10 years ago

treeowl commented 10 years ago

If I set potato = unknown(); then potato.equals(potato) should be true, but @Override @SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"}) public boolean equals(Object obj) { return false; } seems to say otherwise.

npryce commented 10 years ago

The semantics of unknown is like that of NULL in SQL or floating point NaN. It represents a value that is not known, rather one that is known not to exist. If you want a "known-to-be-nonexistent" value, fork the code and change it to behave the way you want.