ScopeFunctionsX<T extends Object> extension
Kotlin-style scope functions available on every non-null value.
These let you keep expression chains flat instead of introducing intermediate local variables.
- on
-
- T
Methods
-
also(
void action(T it)) → T -
Available on T, provided by the ScopeFunctionsX extension
Runsactionwith this value and returns the value unchanged. -
asOrNull<
R> () → R? -
Available on T, provided by the ScopeFunctionsX extension
Safe cast: returns this value asR, ornullif it is not anR. -
let<
R> (R transform(T it)) → R -
Available on T, provided by the ScopeFunctionsX extension
Appliestransformto this value and returns its result. -
takeIf(
bool predicate(T it)) → T? -
Available on T, provided by the ScopeFunctionsX extension
Returns this value whenpredicateholds, otherwisenull. -
takeUnless(
bool predicate(T it)) → T? -
Available on T, provided by the ScopeFunctionsX extension
Returns this value whenpredicatefails, otherwisenull.