Slide 1

Slide 1 text

@TTGonda collectiveidea.com Kotlin: Uncovered Victoria Gonda www.victoriagonda.com @TTGonda

Slide 2

Slide 2 text

@TTGonda collectiveidea.com Holland, MI Dancer Collective Idea

Slide 3

Slide 3 text

@TTGonda collectiveidea.com I ❤ Programming Languages

Slide 4

Slide 4 text

@TTGonda collectiveidea.com DEFINE('BUBBLE(A,ALEN)I,J,UB,TMP') : (BUBBLE_END) BUBBLE I = 1; UB = ALEN OUTER GT(UB,1) :F(BDONE) J = 1 INNER LE(A, A) :S(INCRJ) TMP = A A = A A = TMP INCRJ J = LT(J + 1,UB) J + 1 :S(INNER) UB = UB - 1 :(OUTER) BDONE BUBBLE = A :(RETURN) BUBBLE_END NUMBERS = '33 99 15 54 1 20 88 47 68 72' OUTPUT = "Unsorted List" OUTPUT = NUMBERS; NUMARRAY = ARRAY(10) FLOOP I = I + 1 NUMBERS SPAN('0123456789') . NUMARRAY = :S(FLOOP) BUBBLE(NUMARRAY,10); NUMBERS = '' SLOOP J = J + 1; NUMBERS = NUMBERS NUMARRAY ' ' :S(SLOOP) OUTPUT = TRIM(NUMBERS) END SNOBOL

Slide 5

Slide 5 text

@TTGonda collectiveidea.com HAI 1.2 CAN HAS STDIO? VISIBLE "IS KITTAH GAME!" VISIBLE "ENTER 'HELP' FOR CONTROLS" VISIBLE "" I HAS A NAME VISIBLE "WHAT IS KITTAH'S NAME?" GIMMEH NAME I HAS A ACTION VISIBLE SMOOSH "WAT U WANTING TO DO WITH " NAME "?" MKAY GIMMEH ACTION IM IN YR LOOP NERFIN YR PURRS TIL BOTH SAEM ACTION AN "KBYE" BOTH SAEM ACTION AN "HELP", O RLY? YA RLY VISIBLE "PET" VISIBLE "FEED" VISIBLE "IS HAPPY?" VISIBLE "KBYE" MEBBE BOTH SAEM ACTION AN "PURRS" VISIBLE SMOOSH "PURRS: " PURRS MKAY MEBBE BOTH SAEM ACTION AN "FEED" VISIBLE SMOOSH "YOU DID FEED " NAME ". " NAME " IS HAPPY WITH FOOD." MKAY PURRS R SUM OF PURRS AN 3 LOLCODE

Slide 6

Slide 6 text

@TTGonda collectiveidea.com

Slide 7

Slide 7 text

@TTGonda collectiveidea.com “Statically typed programming language for the JVM, Android and the browser”

Slide 8

Slide 8 text

@TTGonda collectiveidea.com Statically Typed

Slide 9

Slide 9 text

@TTGonda collectiveidea.com Statically Typed final String name = "Victoria"; val name = "Victoria"

Slide 10

Slide 10 text

@TTGonda collectiveidea.com Null Safety

Slide 11

Slide 11 text

@TTGonda collectiveidea.com Null Safety NullPointerException

Slide 12

Slide 12 text

@TTGonda collectiveidea.com Concise

Slide 13

Slide 13 text

@TTGonda collectiveidea.com map{$P=$P[$f^ord($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_} Perl

Slide 14

Slide 14 text

@TTGonda collectiveidea.com

Slide 15

Slide 15 text

@TTGonda collectiveidea.com Java Virtual Machine

Slide 16

Slide 16 text

@TTGonda collectiveidea.com Java Virtual Machine

Slide 17

Slide 17 text

@TTGonda collectiveidea.com

Slide 18

Slide 18 text

@TTGonda collectiveidea.com

Slide 19

Slide 19 text

@TTGonda collectiveidea.com Data Classes Null Safety Delegation Class Extensions Lambdas

Slide 20

Slide 20 text

@TTGonda collectiveidea.com Data Classes

Slide 21

Slide 21 text

@TTGonda collectiveidea.com class User( val firstName: String, var lastName: String? )

Slide 22

Slide 22 text

@TTGonda collectiveidea.com public final class User { @NotNull private final String firstName; @Nullable private String lastName; public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } @NotNull public final String getFirstName() { return this.firstName; } @Nullable public final String getLastName() { return this.lastName; } public final void setLastName(@Nullable String var1) { this.lastName = var1; } }

Slide 23

Slide 23 text

@TTGonda collectiveidea.com public final class User {

Slide 24

Slide 24 text

@TTGonda collectiveidea.com @NotNull private final String firstName; @Nullable private String lastName; public final class User {

Slide 25

Slide 25 text

@TTGonda collectiveidea.com public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } public final class User { @NotNull private final String firstName; @Nullable private final String lastName;

Slide 26

Slide 26 text

@TTGonda collectiveidea.com public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } public final class User { @NotNull private final String firstName; @Nullable private final String lastName; public static void checkParameterIsNotNull( Object value, String paramName) { if (value == null) { // prints error with stack trace throwParameterIsNullException(paramName); } }

Slide 27

Slide 27 text

@TTGonda collectiveidea.com public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } public final class User { @NotNull private final String firstName; @Nullable private final String lastName; public static void checkParameterIsNotNull( Object value, String paramName) { if (value == null) { // prints error with stack trace throwParameterIsNullException(paramName); } } Caused by: java.lang.IllegalStateException: firstName must not be null at com.project.User.(User.kt:8)

Slide 28

Slide 28 text

@TTGonda collectiveidea.com public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } public final class User { @NotNull private final String firstName; @Nullable private final String lastName;

Slide 29

Slide 29 text

@TTGonda collectiveidea.com @NotNull public final String getFirstName() { return this.firstName; } @Nullable public final String getLastName() { return this.lastName; } public final void setLastName(@Nullable String var1) { this.lastName = var1; } } Intrinsics.checkParameterIsNotNull(lastName, "lastName"); super(); this.firstName = firstName; this.lastName = lastName; }

Slide 30

Slide 30 text

@TTGonda collectiveidea.com data class User( val firstName: String, var lastName: String? )

Slide 31

Slide 31 text

@TTGonda collectiveidea.com public final class User { @NotNull private final String firstName; @Nullable private String lastName; public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } @NotNull public final String getFirstName() { return this.firstName; } @Nullable public final String getLastName() { return this.lastName; } public final void setLastName(@Nullable String var1) { this.lastName = var1; } @NotNull public final String component1() { return this.firstName; } @Nullable public final String component2() { return this.lastName; } @NotNull public final User copy(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); return new User(firstName, lastName); } // $FF: synthetic method // $FF: bridge method @NotNull public static User copy$default(User var0, String var1, String var2, int var3, Object var4) { if((var3 & 1) != 0) { var1 = var0.firstName; } if((var3 & 2) != 0) { var2 = var0.lastName; } return var0.copy(var1, var2); } public String toString() { return "User(firstName=" + this.firstName + ", lastName=" + this.lastName + ")"; } public int hashCode() { return (this.firstName != null?this.firstName.hashCode():0) * 31 + (this.lastName != null?this.lastName.hashCode():0); } public boolean equals(Object var1) { if(this != var1) { if(var1 instanceof User) { User var2 = (User)var1; if(Intrinsics.areEqual(this.firstName, var2.firstName) && Intrinsics.areEqual(this.lastName, var2.lastName)) { return true; } } return false; } else { return true; } } }

Slide 32

Slide 32 text

@TTGonda collectiveidea.com @NotNull public final String component1() { return this.firstName; } @Nullable public final String component2() { return this.lastName; } } public final void setLastName(@Nullable String this.lastName = var1; }

Slide 33

Slide 33 text

@TTGonda collectiveidea.com @NotNull public final String component1() { return this.firstName; } @Nullable public final String component2() { return this.lastName; } } public final void setLastName(@Nullable String this.lastName = var1; } // Destructuring Data Class Declarations val user = User("Victoria", "Gonda") val (firstname, lastname) = user

Slide 34

Slide 34 text

@TTGonda collectiveidea.com @NotNull public final String component1() { return this.firstName; } @Nullable public final String component2() { return this.lastName; } } public final void setLastName(@Nullable String this.lastName = var1; }

Slide 35

Slide 35 text

@TTGonda collectiveidea.com @NotNull public final User copy( @NotNull String firstName, @Nullable String lastName) { Intrinsics .checkParameterIsNotNull(firstName, "firstName"); return new User(firstName, lastName); } return this.firstName; } @Nullable public final String component2() { return this.lastName; }

Slide 36

Slide 36 text

@TTGonda collectiveidea.com // $FF: synthetic method // $FF: bridge method @NotNull public static User copy$default( User var0, String var1, String var2, int var3, Object var4) { if((var3 & 1) != 0) { var1 = var0.firstName; } if((var3 & 2) != 0) { var2 = var0.lastName; } return var0.copy(var1, var2); } public final User copy( @NotNull String firstName, @Nullable String lastName) { Intrinsics .checkParameterIsNotNull(firstName, "firstName"); return new User(firstName, lastName); }

Slide 37

Slide 37 text

@TTGonda collectiveidea.com public String toString() { return "User(firstName=" + this.firstName + ", lastName=" + this.lastName + ")"; } if((var3 & 1) != 0) { var1 = var0.firstName; } if((var3 & 2) != 0) { var2 = var0.lastName; } return var0.copy(var1, var2); }

Slide 38

Slide 38 text

@TTGonda collectiveidea.com public int hashCode() { return (this.firstName != null? this.firstName.hashCode():0) * 31 + (this.lastName != null? this.lastName.hashCode():0); } public String toString() { return "User(firstName=" + this.firstName + ", lastName=" + this.lastName + ")"; }

Slide 39

Slide 39 text

@TTGonda collectiveidea.com public boolean equals(Object var1) { if(this != var1) { if(var1 instanceof User) { User var2 = (User)var1; if(Intrinsics.areEqual(this.firstName, var2.firstName) && Intrinsics.areEqual(this.lastName, var2.lastName)) { return true; } } return false; } else { return true; } } } this.firstName.hashCode():0) * 31 + (this.lastName != null? this.lastName.hashCode():0); }

Slide 40

Slide 40 text

@TTGonda collectiveidea.com public final class User { @NotNull private final String firstName; @Nullable private String lastName; public User(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); super(); this.firstName = firstName; this.lastName = lastName; } @NotNull public final String getFirstName() { return this.firstName; } @Nullable public final String getLastName() { return this.lastName; } public final void setLastName(@Nullable String ) { this.lastName = ; } @NotNull public final String component1() { return this.firstName; } @Nullable public final String component2() { return this.lastName; } @NotNull public final User copy(@NotNull String firstName, @Nullable String lastName) { Intrinsics.checkParameterIsNotNull(firstName, "firstName"); return new User(firstName, lastName); } // $FF: synthetic method // $FF: bridge method @NotNull public static User copy$default(User var0, String var1, String var2, int var3, Object var4) { if((var3 & 1) != 0) { var1 = var0.firstName; } if((var3 & 2) != 0) { var2 = var0.lastName; } return var0.copy(var1, var2); } public String toString() { return "User(firstName=" + this.firstName + ", lastName=" + this.lastName + ")"; } public int hashCode() { return (this.firstName != null?this.firstName.hashCode():0) * 31 + (this.lastName != null?this.lastName.hashCode():0); } public boolean equals(Object var1) { if(this != var1) { if(var1 instanceof User) { User var2 = (User)var1; if(Intrinsics.areEqual(this.firstName, var2.firstName) && Intrinsics.areEqual(this.lastName, var2.lastName)) { return true; } } return false; } else { return true; } } }

Slide 41

Slide 41 text

@TTGonda collectiveidea.com data class User( val firstName: String = "Victoria", var lastName: String? ) Default Values

Slide 42

Slide 42 text

@TTGonda collectiveidea.com val user = User(
 lastName = "Gonda" ) Named Parameters

Slide 43

Slide 43 text

@TTGonda collectiveidea.com Null Safety

Slide 44

Slide 44 text

@TTGonda collectiveidea.com // Wont compile
 var maybeString: String? = "Hello"
 maybeString.length

Slide 45

Slide 45 text

@TTGonda collectiveidea.com Safe Call Operator val maybeString: String? = "Hello" maybeString?.length

Slide 46

Slide 46 text

@TTGonda collectiveidea.com String maybeString = "Hello"; maybeString.length(); ? ? ?

Slide 47

Slide 47 text

@TTGonda collectiveidea.com Safe Call Operator val maybeString: String? = null maybeString?.length

Slide 48

Slide 48 text

@TTGonda collectiveidea.com String maybeString = (String) null; if(maybeString != null) { maybeString.length(); }

Slide 49

Slide 49 text

@TTGonda collectiveidea.com val maybeString: String? = null maybeString!!.length // NPE!

Slide 50

Slide 50 text

@TTGonda collectiveidea.com String maybeString = (String) null; if(maybeString == null) { Intrinsics.throwNpe(); } maybeString.length();

Slide 51

Slide 51 text

@TTGonda collectiveidea.com val maybeString: String? = null maybeString?.let { string -> string.length } let

Slide 52

Slide 52 text

@TTGonda collectiveidea.com String maybeString = (String) null; if(maybeString != null) { String string = (String)maybeString; string.length(); } let

Slide 53

Slide 53 text

@TTGonda collectiveidea.com val maybeString: String? = null 
 return maybeString?.length ?: 0 Elvis Operator ?:

Slide 54

Slide 54 text

@TTGonda collectiveidea.com String maybeString = (String)null; 
 if(maybeString != null) {
 return maybeString.length();
 } else {
 return 0; } Elvis Operator ?:

Slide 55

Slide 55 text

@TTGonda collectiveidea.com Delegation

Slide 56

Slide 56 text

@TTGonda collectiveidea.com class CopyPrinter(copier: Copy, printer: Print) : Copy by copier, Print by printer interface Copy { fun copy(page: Page): Page } interface Print { fun print(page: Page) }

Slide 57

Slide 57 text

@TTGonda collectiveidea.com public final class CopyPrinter implements Copy, Print { // $FF: synthetic field private final Copy $$delegate_0; // $FF: synthetic field private final Print $$delegate_1; public CopyPrinter(@NotNull Copy copier, @NotNull Print printer) { Intrinsics.checkParameterIsNotNull(copier, "copier"); Intrinsics.checkParameterIsNotNull(printer, "printer"); super(); this.$$delegate_0 = copier; this.$$delegate_1 = printer; } @NotNull public Page copy(@NotNull Page page) { Intrinsics.checkParameterIsNotNull(page, "page"); return this.$$delegate_0.copy(page); } public void print(@NotNull Page page) { Intrinsics.checkParameterIsNotNull(page, "page"); this.$$delegate_1.print(page); } } public interface Copy { @NotNull Page copy(@NotNull Page var1); } public interface Print { void print(@NotNull Page var1); }

Slide 58

Slide 58 text

@TTGonda collectiveidea.com public final class CopyPrinter implements Copy, Print {

Slide 59

Slide 59 text

@TTGonda collectiveidea.com // $FF: synthetic field private final Copy $$delegate_0; // $FF: synthetic field private final Print $$delegate_1; public final class CopyPrinter implements Copy, Print {

Slide 60

Slide 60 text

@TTGonda collectiveidea.com public CopyPrinter( @NotNull Copy copier, @NotNull Print printer) { Intrinsics .checkParameterIsNotNull(copier, "copier"); Intrinsics .checkParameterIsNotNull(printer, "printer"); super(); this.$$delegate_0 = copier; this.$$delegate_1 = printer; } // $FF: synthetic field private final Copy $$delegate_0; // $FF: synthetic field private final Print $$delegate_1;

Slide 61

Slide 61 text

@TTGonda collectiveidea.com @NotNull public Page copy(@NotNull Page page) { Intrinsics .checkParameterIsNotNull(page, "page"); return this.$$delegate_0.copy(page); } public void print(@NotNull Page page) { Intrinsics .checkParameterIsNotNull(page, "page"); this.$$delegate_1.print(page); } } super(); this.$$delegate_0 = copier; this.$$delegate_1 = printer; }

Slide 62

Slide 62 text

@TTGonda collectiveidea.com public interface Copy { @NotNull Page copy(@NotNull Page var1); } public interface Print { void print(@NotNull Page var1); } public void print(@NotNull Page page) { Intrinsics .checkParameterIsNotNull(page, "page"); this.$$delegate_1.print(page); } }

Slide 63

Slide 63 text

@TTGonda collectiveidea.com public final class CopyPrinter implements Copy, Print { // $FF: synthetic field private final Copy $$delegate_0; // $FF: synthetic field private final Print $$delegate_1; public CopyPrinter(@NotNull Copy copier, @NotNull Print printer) { Intrinsics.checkParameterIsNotNull(copier, "copier"); Intrinsics.checkParameterIsNotNull(printer, "printer"); super(); this.$$delegate_0 = copier; this.$$delegate_1 = printer; } @NotNull public Page copy(@NotNull Page page) { Intrinsics.checkParameterIsNotNull(page, "page"); return this.$$delegate_0.copy(page); } public void print(@NotNull Page page) { Intrinsics.checkParameterIsNotNull(page, "page"); this.$$delegate_1.print(page); } } public interface Copy { @NotNull Page copy(@NotNull Page var1); } public interface Print { void print(@NotNull Page var1); }

Slide 64

Slide 64 text

@TTGonda collectiveidea.com Class Extensions

Slide 65

Slide 65 text

@TTGonda collectiveidea.com Class Extensions TextUtils.isEmpty("hello");

Slide 66

Slide 66 text

@TTGonda collectiveidea.com // StringExt.kt fun String.double(): String { return this + this }

Slide 67

Slide 67 text

@TTGonda collectiveidea.com "hello".double() // -> “hellohello” // StringExt.kt fun String.double(): String { return this + this }

Slide 68

Slide 68 text

@TTGonda collectiveidea.com public final class StringExtKt { @NotNull public static final String double( @NotNull String $receiver) { Intrinsics .checkParameterIsNotNull($receiver, "$receiver"); return $receiver + $receiver; } }

Slide 69

Slide 69 text

@TTGonda collectiveidea.com StringExtKt.double("hello"); // -> "hellohello" public final class StringExtKt { @NotNull public static final String double( @NotNull String $receiver) { Intrinsics .checkParameterIsNotNull($receiver, "$r return $receiver + $receiver; } }

Slide 70

Slide 70 text

@TTGonda collectiveidea.com Lambdas

Slide 71

Slide 71 text

@TTGonda collectiveidea.com fun firstNSquares(n: Int): Array = Array(n, { i -> i * i }) // firstNSquares(3) // -> [0, 1, 4]

Slide 72

Slide 72 text

@TTGonda collectiveidea.com @NotNull public static final Integer[] firstNSquares(int n) { Integer[] result$iv = new Integer[n]; int i$iv = 0; int var3 = n - 1; if(i$iv <= var3) { while(true) { Integer var9 = Integer.valueOf(i$iv * i$iv); result$iv[i$iv] = var9; if(i$iv == var3) { break; } ++i$iv; } } return (Integer[])((Object[])result$iv); }

Slide 73

Slide 73 text

@TTGonda collectiveidea.com @NotNull public static Integer[] firstNSquares(int n) { Integer[] resultArray = new Integer[n]; int i = 0; int max = n - 1; if(i <= max) { while(true) { Integer square = i * i; resultArray[i] = square; if(i == max) { break; } ++i; } } return resultArray; }

Slide 74

Slide 74 text

@TTGonda collectiveidea.com fun firstNSquares(n: Int): Array = Array(n, { i -> square(i + 1) }) // firstNSquares(3) // -> [1, 4, 9]

Slide 75

Slide 75 text

@TTGonda collectiveidea.com @NotNull public static Integer[] firstNSquares(int n) { Integer[] resultArray = new Integer[n]; int i = 0; int max = n - 1; if(i <= max) { while(true) { Integer square = square(i+1); resultArray[i] = square; if(i == max) { break; } ++i; } } return resultArray; }

Slide 76

Slide 76 text

@TTGonda collectiveidea.com inline fun beforeAndAfter( startString: String, function: (string: String) -> String) { print("Before: $startString") val after = function(startString) print("After: $after") }

Slide 77

Slide 77 text

@TTGonda collectiveidea.com inline fun beforeAndAfter( startString: String, function: (string: String) -> String) { print("Before: $startString") val after = function(startString) print("After: $after") } public inline fun T.let(block: (T) -> R): R = block(this)

Slide 78

Slide 78 text

@TTGonda collectiveidea.com inline fun beforeAndAfter( startString: String, function: (string: String) -> String) { print("Before: $startString") val after = function(startString) print("After: $after") }

Slide 79

Slide 79 text

@TTGonda collectiveidea.com public final void beforeAndAfter( @NotNull String startString, @NotNull Function1 function) { Intrinsics .checkParameterIsNotNull(startString, "startString"); Intrinsics .checkParameterIsNotNull(function, "function"); String after = "Before: " + startString; System.out.print(after); after = (String)function.invoke(startString); String var4 = "After: " + after; System.out.print(var4); }

Slide 80

Slide 80 text

@TTGonda collectiveidea.com public final void beforeAndAfter( @NotNull String startString, @NotNull Function1 function) { Intrinsics .checkParameterIsNotNull(startString, "startString"); Intrinsics .checkParameterIsNotNull(function, "function"); String after = "Before: " + startString; System.out.print(after); after = (String)function.invoke(startString); String var4 = "After: " + after; System.out.print(var4); } public interface Function1 : Function { public operator fun invoke(p1: P1): R }

Slide 81

Slide 81 text

@TTGonda collectiveidea.com public final void beforeAndAfter( @NotNull String startString, @NotNull Function1 function) { Intrinsics .checkParameterIsNotNull(startString, "startString"); Intrinsics .checkParameterIsNotNull(function, "function"); String after = "Before: " + startString; System.out.print(after); after = (String)function.invoke(startString); String var4 = "After: " + after; System.out.print(var4); }

Slide 82

Slide 82 text

@TTGonda collectiveidea.com fun example() { beforeAndAfter("hello", { string -> string + " world" }) } // Output “Before: hello" “After: hello world"

Slide 83

Slide 83 text

@TTGonda collectiveidea.com public final void example() { String startString$iv = "hello"; String after$iv = "Before: " + startString$iv; System.out.print(after$iv); String string = (String)startString$iv; after$iv = (String)(string + " world"); string = "After: " + after$iv; System.out.print(string); }

Slide 84

Slide 84 text

@TTGonda collectiveidea.com beforeAndAfter("hello", { string -> string + " world" }) 
 beforeAndAfter("hello", { it + " world" }) 
 beforeAndAfter("hello") { it + " world" } Lambda Parameters

Slide 85

Slide 85 text

@TTGonda collectiveidea.com fun beforeAndAfter( startString: String, function: (string: String) -> String ) { print("Before: $startString") val after = function(startString) print("After: $after") }

Slide 86

Slide 86 text

@TTGonda collectiveidea.com public final void example() { this.beforeAndAfter("hello", (Function1)null.INSTANCE); } // Output “Before: hello” “After: hello world”

Slide 87

Slide 87 text

@TTGonda collectiveidea.com

Slide 88

Slide 88 text

@TTGonda collectiveidea.com // Pseudocode for bytecode final class BytecodeClass extends Lambda implements Function1 { public void invoke(String string) { StringBuilder sb = new StringBuilder("hello"); sb.append(" world"); returnValue = sb.toString(); } static Function1 INSTANCE = new BytecodeClass(); }

Slide 89

Slide 89 text

@TTGonda collectiveidea.com // Pseudocode for bytecode final class BytecodeClass extends Lambda implements Function1 { public void invoke(String string) { StringBuilder sb = new StringBuilder("hello"); sb.append(" world"); returnValue = sb.toString(); } static Function1 INSTANCE = new BytecodeClass(); } public final void example() { this.beforeAndAfter("hello", (Function1)null.INSTANCE); }

Slide 90

Slide 90 text

@TTGonda collectiveidea.com // Pseudocode for bytecode final class BytecodeClass extends Lambda implements Function1 { public void invoke(String string) { StringBuilder sb = new StringBuilder("hello"); sb.append(" world"); returnValue = sb.toString(); } static Function1 INSTANCE = new BytecodeClass(); }

Slide 91

Slide 91 text

@TTGonda collectiveidea.com Companion Objects Smart Casting Collection Functions Control Flow Structures Operator Overloading Named Parameters

Slide 92

Slide 92 text

@TTGonda collectiveidea.com Menu > Tools > Kotlin > Show Kotlin Bytecode or CMD+SHFT+A and search “Show Kotlin Bytecode”

Slide 93

Slide 93 text

@TTGonda collectiveidea.com Code > Convert Java File to Kotlin File or CMD+SHFT+A and search “Convert Java File to Kotlin File”

Slide 94

Slide 94 text

@TTGonda collectiveidea.com DETOUR JAVA

Slide 95

Slide 95 text

@TTGonda collectiveidea.com Thanks! Victoria Gonda www.victoriagonda.com @TTGonda