open static fun <T : Any!> apply(@NonNull optional: Optional<out T>, @NonNull fun: Block<T>): Unit
Run function when optional is not absent.
optional
- Optional<out T>: When optional is present, fun is run
fun
- Block<T>: Function which is run when optional is present
open static fun <T : Any!> apply(@NonNull obj: Any, @NonNull type: Class<T>, @NonNull fun: Block<T>): Unit
Run function when object is of the specific type.
obj
- Any: Object that is to be cast.
type
- Class<T>: Type to cast to.
fun
- Block<T>: Function which is run when object is of the specific type.
open static fun <T : Any!> apply(@NonNull obj: Any, @NonNull type: Class<T>, @NonNull fun: Block<T>, @NonNull otherwise: Runnable): Unit
Run function when object is of the specific type otherwise runnable is run.
obj
- Any: Object that is to be cast.
type
- Class<T>: Type to cast to.
fun
- Block<T>: Function which is run when object is of the specific type.
otherwise
- Runnable: Call this function when object is not of the specified type
open static fun <T : Any!> apply(@NonNull optional: Optional<out T>, @NonNull fun: Block<T>, @NonNull otherwise: Runnable): Unit
Run function when optional is not absent.
optional
- Optional<out T>: When optional is present, fun is run
fun
- Block<T>: Function which is run when optional is present
otherwise
- Runnable: Call this function when optional is not present