is the principal JVM language you use for your main applications? • Kotlin edges past Groovy and Scala in language usage on 2.42% https://snyk.io/blog/jvm-ecosystem-report-2018/
are compiled into JVM primitives where possible. •Compiler decides •Works because of missing widening int a = 1; double b = a; val a:Int = 1 val b:Double = a
+ see below Expression Translated to +a a.unaryPlus() -a a.unaryMinus() !a a.not() Expression Translated to a + b a.plus(b) a - b a.minus(b) a * b a.times(b) a / b a.div(b) a % b a.rem(b), a.mod(b) (deprecated) a..b a.rangeTo(b)
0 a < b a.compareTo(b) < 0 a >= b a.compareTo(b) >= 0 a <= b a.compareTo(b) <= 0 Expression Translated to a == b a?.equals(b) ?: (b === null) a != b !(a?.equals(b) ?: (b === null))
!in b !b.contains(a) Expression Translated to a[i] a.get(i) a[i, j] a.get(i, j) a[i_1, ..., i_n] a.get(i_1, ..., i_n) a[i] = b a.set(i, b) a[i, j] = b a.set(i, j, b) a[i_1, ..., i_n] = b a.set(i_1, ..., i_n, b)
j) a.invoke(i, j) a(i_1, ..., i_n) a.invoke(i_1, ..., i_n) Expression Translated to a += b a.plusAssign(b) a -= b a.minusAssign(b) a *= b a.timesAssign(b) a /= b a.divAssign(b) a %= b a.remAssign(b), a.modAssign(b) (deprecated)
sequentially suspend fun concurrentSum(): Int = coroutineScope { val one = async { doSomethingUsefulOne() } val two = async { doSomethingUsefulTwo() } one.await() + two.await() }
(vs open) •Inner class: static by default (vs inner) •Stricter usage of protected •New visibility: internal •One file can have multiple public classes •„global“ functions & variables are allowed
in favor of Java [..], to 1.2% in favor of Kotlin [..] • Memory consumption: appeared the lowest in the Java implementation in four out of six benchmarks. • CPU load: no significant distinction in load management https://medium.com/@bards95/comparative-evaluation-of-selected-constru cts-in-java-and-kotlin-part-1-dynamic-metrics-2592820ce80
in favor of Java [..], to 1.2% in favor of Kotlin [..] • Memory consumption: appeared the lowest in the Java implementation in four out of six benchmarks. • CPU load: no significant distinction in load management https://medium.com/@bards95/comparative-evaluation-of-selected-constru cts-in-java-and-kotlin-part-1-dynamic-metrics-2592820ce80
in favor of Java [..], to 1.2% in favor of Kotlin [..] • Memory consumption: appeared the lowest in the Java implementation in four out of six benchmarks. • CPU load: no significant distinction in load management https://medium.com/@bards95/comparative-evaluation-of-selected-constru cts-in-java-and-kotlin-part-1-dynamic-metrics-2592820ce80
the lines of code by approximately 40 % (JetBrains) … tests show … the number of code lines reduces by 30… https://belitsoft.com/apps-development-services/java-vs-kotlin
null-handling) but feels like a very careful amalgamation of some of the best features of other languages. Rob Fletcher, Netflix https://belitsoft.com/apps-development-services/java-vs-kotlin