T - Data type of element(s) stored in this containerR - Data type of element(s) stored in the container to be used if this container is emptypublic interface OnEmptySwitch<T,R>
| Modifier and Type | Method and Description |
|---|---|
OnEmptySwitch<T,R> |
onEmptySwitch(java.util.function.Supplier<? extends R> supplier)
Switch to container created by provided Supplier, if current Container empty
|
OnEmptySwitch<T,R> onEmptySwitch(java.util.function.Supplier<? extends R> supplier)
ListX.empty().onEmptySwitch(()->ListX.of(1));
supplier - to create replacement container