Re:From Java to Kotlin and Back Again
by jrs95 on Wednesday May 23, 2018 @04:10PM
(#17137750)
Yes, Java lambdas are just syntactic sugar over anonymous classes with a single method IIRC. You must define a full Interface to use when defining the function signature. Kotlin functions are essentially objects that can be passed around, stored in variables, etc. You can also have functions that don’t belong to any class, no need to use static methods for that.
[ Parent
| on HN ]
Not exactly, lambdas use invokedynamic which has different performance characteristics when compared to anonymous classes.
See a talk by Brian Goetz - https://www.youtube.com/watch?v=MLksirK9nnE