• 时间:
  • 浏览:3
  • 来源:5分排列3APP下载_5分排列3APP官方

Target either the JVM or JavaScript. Write code in Kotlin and decide where you want to deploy to

自从Kotlin 成为 Android 开发一级语言,Kotlin实在以实在用,高效赢得了海外不多 公司和开发者的认可,比如Square的Jake大神一个劲 在推Kotlin。Kotlin在国外合适有将近2年的应用生产环境的实践(非JetBrains组织组织结构实践应用)。在移动开发中,相比iOS进程池池员,Android进程池池员一个劲 很幸运,机会我们都都有不多 优秀好用的工具(Android Studio等),选泽Kotlin,则是Google 为开发者提供高效的开发工具的一贯作风。

import io.reactivex.Flowable

import io.reactivex.schedulers.Schedulers

val positiveNumbers = list.filter { it > 0 }

Want a singleton? Create an object:

Use any existing library on the JVM, as there’s 30% compatibility, including SAM support.

[java] view plain copy

fun calculateTotal(obj: Any) {


Create a POJO with getters, setters, equals(), hashCode(), toString() and copy() in a single line:

object ThisIsASingleton {

data class Customer(val name: String, val email: String, val company: String)

Or filter a list using a lambda expression:


Kotlin是静态类型编程语言,用于现代多平台应用,30%可与Java™和Android™互操作 [java] view plain copy

var output: String

output = null // Compilation error

Kotlin protects you from mistakenly operating on nullable types

import kotlin.browser.window


[java] view plain copy

val name: String? = null // Nullable type

println(name.length()) // Compilation error

And if you check a type is right, the compiler will auto-cast it for you


Get rid of those pesky NullPointerExceptions, you know, The Billion Dollar Mistake


fun onLoad() {