Skip to content

Instantly share code, notes, and snippets.

@shahsurajk
Created November 27, 2019 18:35
Show Gist options
  • Save shahsurajk/e6198450dcf866caeec54e8461b984c7 to your computer and use it in GitHub Desktop.
Save shahsurajk/e6198450dcf866caeec54e8461b984c7 to your computer and use it in GitHub Desktop.
Decompiled lambda without inline
public static final void myBigLoop() {
byte var0 = 0;
Iterable $receiver$iv = (Iterable)(new IntRange(var0, 50));
Iterator var1 = $receiver$iv.iterator();
while(var1.hasNext()) {
int element$iv = ((IntIterator)var1).nextInt();
int var4 = false;
// our function being called with a singleton instance of our Function1 implementated class
testLambdas(element$iv, (Function1)PresentationKt$myBigLoop$1$1.INSTANCE); // note the use of a singleton here
}
}
// our lambda, made into a class and implementing the Function1 interface!
final class PresentationKt$myBigLoop$1$1 extends Lambda implements Function1 {
// Kotlin complier generates a singleton for lambdas without closure.
// but for lambdas with closure, a new instance will be created everytime.
public static final PresentationKt$myBigLoop$1$1 INSTANCE = new PresentationKt$myBigLoop$1$1();
// other methods of this class..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment