Make Maybe's toString closer to the actual code

This commit is contained in:
Martin Duhem 2016-08-21 14:24:34 +02:00
parent 432c93b0bb
commit 4e233d81f9
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ public abstract class Maybe<t>
public boolean isDefined() { return true; }
public s get() { return v; }
public int hashCode() { return 17 + (v == null ? 0 : v.hashCode()); }
public String toString() { return "Maybe(" + v + ")"; }
public String toString() { return "Maybe.just(" + v + ")"; }
public boolean equals(Object o) {
if (o == null) return false;
if (!(o instanceof Maybe)) return false;
@ -32,7 +32,7 @@ public abstract class Maybe<t>
public boolean isDefined() { return false; }
public s get() { throw new UnsupportedOperationException("nothing.get"); }
public int hashCode() { return 1; }
public String toString() { return "Nothing"; }
public String toString() { return "Maybe.nothing()"; }
public boolean equals(Object o) {
if (o == null) return false;
if (!(o instanceof Maybe)) return false;