语言概述
WHY Kotlin
Concise
Safe
Interoperable
IDE
构建Java项目
Android Stuido 构建Android项目
playground
Warnings as errors
基础
基本语法
迭代器
异常处理
集合处理
函数
字符串
字符串模板
类、对象、接口
类型
可空类型
Any、Unit、Nothing
集合与数组
注释
继承
IDE
- 构建Java项目
Android Stuido 构建Android项目
playground
Warnings as errors
语法
顶层函数
扩展函数
可变函数
局部函数
组件函数
中缀调用
解构声明
内部类
嵌套类
密封类
元祖类型
修改访问器的可见性
伴生对象
lambda 表达式
高阶函数
内联函数
let函数
延迟初始化属性
委托属性
只读集合与可变集合
泛型
运行时泛型
泛型与子类型化
斜变(out T)
逆变 (in T)
使用点变型
星号投影
泛型函数
泛型约束
注解元注解
多重继承
关键字
when类委托——
by类与实例——
objectis运算符安全调用运算符
Elvis运算符
安全转换——
as非空断言
rangeTo
函数
版本特性
v1.1
协程
类型别名
已绑定的可调用引用
密封类和数据类
lambda 表达式中的解构
其他
下划线用于未使用的参数
数字字面值中的下划线
对于属性的更短语
内联属性访问器 及 inline关键字
局部委托属性
委托属性绑定的拦截
泛型枚举值访问
标准库更新(参考文档)
抽象集合
v1.2
多平台项目(Multiplatform Projects)
注解中的数组常量
lateinit
允许使用lateinit修饰属性及局部变量
允许您检查一个 lateinit 变量是否已被初始化
inline函数允许使用默认参数(Inline functions with default functional parameters )
智能类型转换(Smart cast improvements)
泛型类型绑定(Information from explicit casts is used for type inference)
智能类型转换(Smart cast improvements)
Deprecation
data classes overriding copy
枚举使用嵌套类型(nested types in enum entries )
single named argument for vararg
继承Throwable的泛型类的内部类(inner classes of generic classes extending Throwable)
mutating backing field of a read-only property
标准库
windowed, chunked, zipWithNext
fill, replaceAll, shuffle/shuffled
Math operations in kotlin-stdlib
Operators and conversions for BigInteger and BigDecimal
Floating point to bits conversions
Regex is now serializable
Closeable.use calls Throwable.addSuppressed if available
Android
- Anko
参考文献
《Kotlin 官方参考文档》
《Kotlin 极简教程》
《Kotlin 实战》