Kotlin is more convenient

Kotlin is more convenient

Constructor

  • Times constructor

  • Primary constructor

  • Main constructor in a statement attribute

Function to simplify

  • Use =connected Return value

  • Parameter Default

  • Named parameters

  • Local function

String

  • String template
  • Native string

Arrays and collections

  • Operator and set arrays
    • forEach
    • filter
    • map
    • flatMap
  • Range
  • Sequence

Conditions control

  • if/else
  • when
  • for
  • try-catch
  • ?.with?:
  • == with ===

reference

kaixue.io

Guess you like

Origin www.cnblogs.com/chen-ying/p/12584524.html