fun loadUser(id: String) { apiClient.getUser(id) .observeOn(AndroidSchedulers.main()) .subscribe { user -> userNameView.text = user.name } } data class
3. click “Install JetBrains plugin…” 4. find “Kotlin” from the list, and click “Install plugin” 5. wait for installation to complete 6. restart AS to enable the plugin
goo.gl/Ec1Gpi name receiver parameters return let T block: (T)->R R run T block: T.()->R R apply T block: T.()->Unit T with - receiver: T, block: T.()->R R * T and R are any types.
by Jake Wharton • use delegated properties val submitButton: Button by bindView(R.id.submit) val nameTextView: TextView? by bindOptionalView(R.id.name)
null && bar != null && baz != null) { // NG because they are stil nullable execute(foo, bar, baz) } for { foo <- foo bar <- bar baz <- baz } yield execute(foo, bar, baz) Kotlin dose not have such syntax
The time has come! • Getting started is easy • Extensions & scope functions are your friends • It’s easy to deal with nullable • Interfaces make extensions more powerful • “Double context extensions”, my idea