chain

open fun <A> chain(transform: (T) -> Pointer<A>): Pointer<A>(source)

Chain the value of the pointer. Creates a new pointer which will get the value on access, transform it and return it. So if you change the value of the original pointer the value of the new pointer will change too. Is the same as transform but the transform functions parameter should return a value, this function parameter should return a pointer.

WARNING: If you access the value of the transformed pointer multiple times the transform function will be called multiple times too. So for performance reasons you should get the value of the pointer and store it in a variable if you need it multiple times (and don't need the changes of the original pointer).

Return

The new pointer

Since

0.1.0

Parameters

transform

The transform function