$30 off During Our Annual Pro Sale. View Details »

Level Up your Kotlin game

Yousuf Haque
February 21, 2018

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

    View Slide

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

    View Slide

  3. Type Inference

    View Slide

  4. Type Inference Isn’t Perfect

    View Slide

  5. Type Inference Works With Expressions

    View Slide

  6. Nothing is a Subtype of Everything

    View Slide

  7. Platform Types

    View Slide

  8. Platform Types

    View Slide

  9. View Slide

  10. Extension Functions and Properties

    View Slide

  11. Lambda Expression Syntax

    View Slide

  12. Higher Order Functions

    View Slide

  13. View Slide

  14. Lambda with Receiver

    View Slide

  15. Lambda with Receiver Comparison

    View Slide

  16. View Slide

  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

    View Slide

  18. Let: basically a map function

    View Slide

  19. Run: same as let, but change scope

    View Slide

  20. Apply: modify something and return it

    View Slide

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

    View Slide

  22. Sealed Classes

    View Slide

  23. Sealed Class, When matching, Smart Casting

    View Slide

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

    View Slide