Any difference between these two?
Is there any behavior difference between these two functions?
inline fun C.onEach1(action: (T) -> Unit): C {
return apply { for (element in this) action(element) }
}
(onEach1 is the onEach function in stdlib 1.9.0)
inline fun Iterable.onEach2(action: (T) -> Unit): Iterable {
return apply { for (element in this) action(element) }
}
If they are the same, is one style preferred over the other?
thanks!
1 post - 1 participant
<a...