Package com.google.mu.util
Interface Premise
public interface Premise
Result of a previously evaluated condition. Used to fluently chain API calls like
Optionals.ifPresent()
. For example:
ifPresent(getStory(), Story::tell)
.or(() -> ifPresent(getJoke(), Joke::tell))
.orElse(() -> print("can't tell"));
- Since:
- 1.14
-
Method Summary
Modifier and TypeMethodDescriptionor
(CheckedSupplier<? extends Premise, E> alternative) Evaluatesalternative
ifthis
premise doesn't hold.<E extends Throwable>
voidorElse
(CheckedRunnable<E> block) Runsblock
ifthis
premise doesn't hold.
-
Method Details
-
or
Evaluatesalternative
ifthis
premise doesn't hold.- Throws:
E
-
orElse
Runsblock
ifthis
premise doesn't hold.- Throws:
E
-