Category: Kotlin

0

Kotlin – Getter & Setter

Getter and setter implementation on Kotlin more looks like C# style than Java. If Java separate getter and setter in spesific function, Kotlin do it on their property directly. For example you can write...

0

Kotlin – Using Extensions

In Kotlin you can add new function without having to inherit from the class or use any type of design pattern such as Decorator, this ability called “Extension”. For example: fun MutableList<String>.addPercentage(){ for((index, item) in...

3

Android Kotlin – Using toObject() to get Firestore Data

From our post about how to get Firestore data on Kotlin here, we grab Firestore data by it name: for (document in task.result) { list_member.add(Member(document.id,document.get(“first”).toString(), document.get(“last”).toString(), document.get(“born”).toString())) } Since Firestore allow us to convert...

0

Loops in Kotlin

Kotlin provide some way to do loops on your code, here they are:   FOR LOOP There’s some kind of FOR loop in Kotlin: Using Range for(x in 1..5){ print(x) } output: 12345 for(x in...