ObjectUtils<T> extension
Kotlin-style scope function extensions on any Object.
These are inspired by Kotlin's let, also, takeIf, and takeUnless
and are useful for chaining operations without intermediate variables.
- on
-
- T
Methods
-
also(
void block(T)) → T -
Available on T, provided by the ObjectUtils extension
Callsblockwith this value for a side effect, then returns this value. -
let<
R> (R block(T)) → R -
Available on T, provided by the ObjectUtils extension
Callsblockwith this value and returns the result. -
takeIf(
bool predicate(T)) → T? -
Available on T, provided by the ObjectUtils extension
Returns this value ifpredicateistrue, otherwisenull. -
takeUnless(
bool predicate(T)) → T? -
Available on T, provided by the ObjectUtils extension
Returns this value ifpredicateisfalse, otherwisenull.