3 ms·
May I describe it as an effectful identity ?
May I describe it as an effectful identity ?
It is not an identity because you can modify the internal state of the objects. And it is also lazy:
arrayOf("A","B","C").onEach{ print("onEach $it")}.forEach{ print("forEach $it")}
prints:
onEach A
forEach A
onEach B
forEach B
onEach C
forEach C