Android: A quick Kotlin Eksperience | Lava Lamp Lab
drupal verses wordpress
What Makes Drupal Awesome Compared To WordPress
Mar 12, 2019
ionic framework
Reusable Components and rxjs Observables in Ionic-Angular
Apr 8, 2019

Android: A quick Kotlin Eksperience

kotlin

Benefits of using Kotlin

Original Presentation: Android – A quick Kotlin Eksperience

 

1.No Semi-Colon
2.Default Values
3.Extension Functions
4.Data Classes
5.Parcelize
6.Unit Functions
7.Null Operations

 

No Semicolons

This is probably the thing smallest things but has a huge effect on readability of code. A couple things to note is that there’s no new keyword and you don’t need to declare the type.

Default Values

 

 

 

 

Data Classes – Code

=

 

 

 

 

 

 

 

Kotlin data class benefits

1.The properties declared in the constructor: this technically is not exclusive to a data class, but it avoids all the boilerplate of getters and setters, in addition to the constructor

2.Provides the equals() & hashCode() functions

3.Provides a copy() method, very useful when we use immutable objects.

 

Parcelize – Code

=

 

 

 

 

 

 

 

 

 

The old implementation of Parcelize, required you to write a writeToParcelize class and create a new Creator class and was generally more work than it should have been. The more parameters you had in the Model Class the longer your code would inevitably become

Extension Functions – Code

Extension Function Usage

 

Unit functions

 

 

 

Null Operators

 

 

Leave a Reply

Your email address will not be published.