Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Level Up your Kotlin game

Level Up your Kotlin game

Most Kotlin features are easy to pick up and obvious in their benefit, but there are a bunch of features sneaking around the standard library and at the language level that are not as prominent. This talk is a grab bag of such features, tips, tricks, and patterns that you can use to bring your Kotlin skill to the next level.

Yousuf Haque

February 21, 2018
Tweet

More Decks by Yousuf Haque

Other Decks in Programming

Transcript

  1. Level Up Your Kotlin Game Useful Kotlin tips you might

    have missed @YousufHaque
  2. Kotlin Type Diamond https://www.slideshare.net/compscicenter/kotlin-2016-mixing-java-and-kotlin

  3. Type Inference

  4. Type Inference Isn’t Perfect

  5. Type Inference Works With Expressions

  6. Nothing is a Subtype of Everything

  7. Platform Types

  8. Platform Types

  9. None
  10. Extension Functions and Properties

  11. Lambda Expression Syntax

  12. Higher Order Functions

  13. None
  14. Lambda with Receiver

  15. Lambda with Receiver Comparison

  16. None
  17. Kotlin Standard Library Extension Functions https://hackernoon.com/kotlin-a-deeper-look-8569d4da36f Lambda With Receiver Lambda

    With Parameter Returns Receiver Returns Last Expression
  18. Let: basically a map function

  19. Run: same as let, but change scope

  20. Apply: modify something and return it

  21. Also: same as apply, but don’t change scope

  22. Sealed Classes

  23. Sealed Class, When matching, Smart Casting

  24. Thank You Twitter: @YousufHaque Github: Yousuf-Haque