Hey, I was wondering if there's a shortcut in kotl...
# functional
e
Hey, I was wondering if there's a shortcut in kotlin similar to ruby's tap. In ruby I can do
[1,2,3].tap { |a| a.add(4)}
and it returns
[1, 2, 3, 4]
. In Kotlin it could be useufl to turn three lines into one:
val x = X(); x.init(); return x
vs
return X().tap { init() }
. I could implement my own tap but I wonder if there's already an existing helper for this.