pouyaesm / kotlin-tutorial

This is a collection of short code snippets to learn Kotlin's main features from basic to advanced

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

This is a collection of short code snippets to learn Kotlin's main features from basic to advanced.


List

  1. Hello world (Go to code)
  2. String manipulation (Go to code)
  3. Variables (Go to code)
  4. Null Safety (Go to code)
    • For example, type String? can be null but cannot be assigned to non-null type String.
  5. Arrays (Go to code)
  6. Conditionals (Go to code)
  7. Functions (Go to code)
  8. Classes (Go to code)
  9. object keyword: static members, singleton, anonymous class (Go to code)
  10. Operator overload (Go to code)
    • Define '+' or '++' for custom objects
  11. Java in Kotlin (Go to code), and Kotlin in Java (Go to code)
  12. Diverse tricks (Go to code)
  13. Deprecating code (Go to code)
    • It is possible to deprecate a function in multiple levels, and defining an automated code for replacement.
  14. Using co-routines, comparing co-routines with threads (Go to code)
    • Kotlin CoRoutines are very light-weight compared to java Thread.
  15. Domain Specific Language (DSL) style programming using higher-order functions (Go to code)
  16. Class property delegation (Go to code)
    • This is used to intercept the setting / getting of a class property
  17. Using Let when there is concurrency (Go to code)
    • Uses a local copy to ensure that a variable will not be null inside a block

References

  1. Kotlin Tutorial - Derek Banas
  2. 10 Kotlin Tricks in 10 ish minutes by Jake Wharton
  3. Kotlin 102 - Beyond the basics by Hadi Hariri
  4. Kotlin Tutorial - Telusko Learnings
  5. KotlinConf 2017 - Introduction to Coroutines by Roman Elizarov

About

This is a collection of short code snippets to learn Kotlin's main features from basic to advanced

License:Apache License 2.0


Languages

Language:Kotlin 98.5%Language:Java 1.5%