Package org.organicdesign.fp.oneOf
Class Or.Bad<G,B>
- java.lang.Object
-
- org.organicdesign.fp.oneOf.Or.Bad<G,B>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description B
bad()
Returns the bad value if this is a Bad, or throws an exception if this is a Good.boolean
equals(Object other)
G
good()
Returns the good value if this is a Good, or throws an exception if this is a Bad.int
hashCode()
boolean
isBad()
Returns true if this Or has a bad value.boolean
isGood()
Returns true if this Or has a good value.<R> R
match(@NotNull Fn1<G,R> fg, @NotNull Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.@NotNull String
toString()
-
-
-
Method Detail
-
isGood
public boolean isGood()
Returns true if this Or has a good value.
-
isBad
public boolean isBad()
Returns true if this Or has a bad value.
-
good
public G good()
Returns the good value if this is a Good, or throws an exception if this is a Bad.
-
bad
public B bad()
Returns the bad value if this is a Bad, or throws an exception if this is a Good.
-
match
public <R> R match(@NotNull @NotNull Fn1<G,R> fg, @NotNull @NotNull Fn1<B,R> fb)
Exactly one of these functions will be executed - determined by whether this is a Good or a Bad.
-
-