public interface Or<G,B>
| Modifier and Type | Interface and Description |
|---|---|
static class |
Or.Bad<G,B>
Represents the presence of a Bad value (and absence of a Good).
|
static class |
Or.Good<G,B>
Represents the presence of a Good value (and absence of a Bad).
|
| Modifier and Type | Method and Description |
|---|---|
B |
bad()
Returns the bad value if this is a Bad, or throws an exception if this is a Good.
|
static <G,B> Or.Bad<G,B> |
bad(B bad)
Construct a new Bad from the given object.
|
G |
good()
Returns the good value if this is a Good, or throws an exception if this is a Bad.
|
static <G,B> Or.Good<G,B> |
good(G good)
Construct a new Good from the given object.
|
boolean |
isBad()
Returns true if this Or has a bad value.
|
boolean |
isGood()
Returns true if this Or has a good value.
|
static <B,G,R> R |
patMatch(Or<G,B> either,
Function1<? super G,R> g,
Function1<? super B,R> b)
Pattern-match, applying the first function if the given either is a Bad, the second if it's a Good.
|
boolean isGood()
boolean isBad()
G good()
B bad()
static <G,B> Or.Good<G,B> good(G good)
static <G,B> Or.Bad<G,B> bad(B bad)
static <B,G,R> R patMatch(Or<G,B> either, Function1<? super G,R> g, Function1<? super B,R> b)
either - the non-null Or to match againstg - the function to apply if the Or is Goodb - the function to apply if the Or is BadIllegalArgumentException - if either is null.Copyright © 2017. All rights reserved.