3 ms·
Quick summary of Kotlin and why you'd want to use it in Android: Lambdas Fairly lightweight, probably looking at 10% overhead only Can ducktype existing
by RyanZAG 13y ago
Quick summary of Kotlin and why you'd want to use it in Android:
Lambdas
Fairly lightweight, probably looking at 10% overhead only
Can ducktype existing classes. eg add "hello".reverse()
IDE support in Jetbrains (but not in eclipse)
Can turn 'try..finally' into library methods
Full interop with java files in same project
val/var types help to reduce side effects
- hhariri 13y agoIn addition it removes a lot of boilerplate code with things such as automatic casting. Adds null safety.
- dodyg 13y agoFor me it's the function expansion syntax. fun main(args : Array<String>) { val a = calculate(1) { x -> 10 + x } //11 val b = calculate(2) { x -> 20 * x } //40 println("a = $a, b = $b") } fun calculate(a : Int, calc : (Int) -> Int) : Int{ return calc(a) }