Coroutines in Kotlin## Coroutines in Kotlin Andrey.Breslav@JetBrains.com This talk could have been named... • async/await/yield • fibers Suspendable Computations • [stackless] continuations ## Outline • Motivation/Examples Motivation/Examples • Solutions in other languages • Kotlin's Solution – Client code – Library code • Compiling Coroutines • Exception Handling • Appendix. Serializable Coroutines? ## “Legal” • All I’m |---|---|---| |Language restrictions|Use in special contexts 😢|Use anywhere 😢| |Implemented in|C#, Scala, Kotlin, ...|Quasar, Javaflow, ...| |Code transformation|Local (compiler magic) 😢|All over the place 😢|0 码力 | 39 页 | 1.01 MB | 2 年前3
Kotlin 1.4 language features### Kotlin 1.4 Language Features Svetlana Isakova ### Kotlin 1.4 Language Features • SAM conversions for Kotlin classes • Explicit API mode • Trailing comma • Break and continue inside when expressions arguments • New type inference • Unified exception type for null checks ## SAM conversions for Kotlin interfaces ## SAM = Single abstract method interface Action { fun run() } ## SAM conversion runAction(Action action) { action.run(); } Kotlin: runAction { println("I'm Kotlin 1.3") } ## SAM conversion for a Kotlin interface Java: Kotlin: interface Action { fun run() } fun0 码力 | 69 页 | 3.29 MB | 2 年前3
Kotlin 1.2 Language Documentationp1_1.jpg) Kotlin Language Documentation ## Table of Contents Overview ..... 5 Using Kotlin for Server-side Development ..... 5 Using Kotlin for Android Development ..... 7 Kotlin JavaScript Overview Overview ..... 8 Kotlin/Native for Native ..... 9 Coroutines for asynchronous programming and more ..... 11 Multiplatform Programming ..... 12 What's New in Kotlin 1.1 ..... 14 What's What's New in Kotlin 1.2 ..... 23 What's Coming in Kotlin 1.3 ..... 29 Standard library ..... 33 Tooling ..... 35 Getting Started ..... 36 Basic Syntax ..... 36 Idioms ..... 42 Coding Conventions0 码力 | 333 页 | 2.22 MB | 2 年前3
A Security Guide for Kotlin Developers## A Security Guide for Kotlin Developers  Overview.....1 Kotlin's Security Profile.....2 Most Common Security Attacks Attacks.....3 Top Kotlin Security Risk.....5 OWASP Mobile TOP 10 Mobile Risks.....10 Protect Your Kotlin Programs with Kiuwan.....11 A pragmatic, modern, and statically typed coding language that's essentially a Java alternative, Kotlin offers some key benefits for Java Virtual Machine (JVM) and Android app development while also being interoperable alongside Java. Kotlin language is general purpose0 码力 | 13 页 | 1.80 MB | 2 年前3
Kotlin Language Documentation 1.3Kotlin Language Documentation ## Table of Contents Overview ..... 7 .Using Kotlin for Server-side Development ..... 7 Using Kotlin for Android Development ..... 9 .Kotlin JavaScript Overview Overview ..... 11 .Kotlin/Native for Native ..... 13 Kotlin for Data Science ..... 15 .Coroutines for asynchronous programming and more ..... 20 Multiplatform Programming ..... 21 What's What's New in Kotlin 1.1 ..... 24 What's New in Kotlin 1.2 ..... 35 What's New in Kotlin 1.3 ..... 44 Standard library ..... 50 Tooling ..... 52 Getting Started ..... 530 码力 | 597 页 | 3.61 MB | 2 年前3
Kotlin Language Documentation 1.9.201a/p1_1.jpg) Kotlin Language Documentation 1.9.20 ## Table of Contents Kotlin Docs 61 Get started with Kotlin 61 Install Kotlin 61 Create your powerful application with Kotlin 61 Is anything anything missing? 63 Welcome to our tour of Kotlin! 63 Hello world 63 Variables 64 String templates 64 Practice 65 Next step 65 Basic types 65 Practice 66 Next step 67 Collections 67 List What's next? ..... 90 Kotlin Multiplatform ..... 90 Kotlin Multiplatform use cases ..... 91 Code sharing between platforms ..... 91 Get started ..... 92 Kotlin for server side ..... 920 码力 | 1299 页 | 32.44 MB | 2 年前3
Kotlin 入门学习笔记整理修饰的静态变量的字符串,是个编译器常量(编译器编译的时候,已经确定并且不可改变的) private static final String LALALA = "lalala"; ## kotlin 中的表示方式 companion object { const val LALALA = "lalala" 3 } ## 定义变量 变量名后“:”跟着他的类型,类型可以省略掉 (lesson : Lesson in lessonList){ 3 } ## 创建对象(直接调用构造器) java: Java = Java() 返回值 java void kotlin Unit ## kotlin 的类型推断 1 // 数据类型 首字母大写 2 var age: Int = 18 3 // 因为类型推断,基本数据类型可以省略 4 var age = 18 ## 修饰符 也是用 class ## 静态内部类 java 中 用 static 修饰;静态内部类可以写静态函数 kotlin 静态内部类是没有关键字修饰; ## 嵌套内部类 不用 static 修饰的话默认的内部类就是嵌套内部类,嵌套内部类可以获取外部类的引用,不可以写静态函数;kotlin 嵌套内部类是有关键字修饰,用 inner 修饰 ## 实现接口 实现接口和继承都是没有关键字,实现接口0 码力 | 8 页 | 5.41 MB | 2 年前3
Hello 算法 1.1.0 Kotlin版FELLO FELLO FELLO FELLO FELLO FELLO >Hello算法 动画图解、一键运行的数据结构与算法教程 靳宇栋 (@krahets) ## Hello 算法 Kotlin 语言版 作者:靳宇栋 (@krahets) 代码审阅:陈东辉 (@curtishd)  // 从底至顶堆化 siftUp(size() - 1) } /* 从节点 i 开始,从底至顶堆化 */ fun siftUp(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 获取节点 i 的父节点 val p = parent(i) 1) // 从顶至底堆化 siftDown(0) // 返回堆顶元素 return_val /* 从节点 i 开始,从顶至底堆化 */ fun siftDown(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 判断节点 i, l, r 中值最大的节点,记为 ma0 码力 | 381 页 | 18.47 MB | 2 年前3
Kotlin 1.9.10 官方文档 中文版png) ## Kotlin 官方文档中文版 ## 目录 关于本书 1.1 文档 1.1.1 入门 1.2 Kotlin 之旅 1.3 概述 1.4 Kotlin 多平台 1.4.1 Kotlin 用于服务器端开发 1.4.2 Kotlin 用于 Android 开发 1.4.3 Kotlin Wasm 1.4.4 Kotlin 原生 1.4.5 Kotlin 用于 JavaScript 4.6 Kotlin 用于数据科学 1.4.7 Kotlin 用于竞技程序设计 1.4.8 Kotlin 的新特性 1.5 Kotlin 1.9.0 1.5.1 Kotlin 1.9.20-RC 1.5.2 早期版本 1.5.3 Kotlin 1.8.20 1.5.3.1 Kotlin 1.8.0 1.5.3.2 Kotlin 1.7.20 1.5.3.3 Kotlin 1.7.0 3.4 Kotlin 1.6.20 1.5.3.5 Kotlin 1.6.0 1.5.3.6 Kotlin 1.5.30 1.5.3.7 Kotlin 1.5.20 1.5.3.8 Kotlin 1.5.0 1.5.3.9 Kotlin 1.4.30 1.5.3.10 Kotlin 1.4.20 1.5.3.11 Kotlin 1.4.0 1.5.3.12 Kotlin 1.3 10 码力 | 3753 页 | 29.69 MB | 2 年前3
Kotlin 1.9.10 官方文档 中文版1.2 3. Kotlin 之旅 1.3 4. 概述 1.4 1. Kotlin 多平台 1.4.1 2. Kotlin 用于服务器端开发 1.4.2 3. Kotlin 用于 Android 开发 1.4.3 4. Kotlin Wasm 1.4.4 5. Kotlin 原生 1.4.5 6. Kotlin 用于 JavaScript 7. Kotlin 用于数据科学 1.4.7 8. Kotlin 用于竞技程序设计 1.4.8 5. Kotlin 的新特性 1.5 1. Kotlin 1.9.0 1.5.1 2. Kotlin 1.9.20-RC 1.5.2 3. 早期版本 1.5.3 1. Kotlin 1.8.20 1.5.3.1 2. Kotlin 1.8.0 5.3.2 3. Kotlin 1.7.20 1.5.3.3 4. Kotlin 1.7.0 1.5.3.4 5. Kotlin 1.6.20 1.5.3.5 6. Kotlin 1.6.0 1.5.3.6 7. Kotlin 1.5.30 1.5.3.7 8. Kotlin 1.5.20 1.5.3.8 9. Kotlin 1.5.0 1.50 码力 | - 页 | 22.65 MB | 2 年前3
共 288 条
- 1
- 2
- 3
- 4
- 5
- 6
- 29
相关搜索词
coroutinesasync/awaitfiberssuspendable computationscontinuationsSAM转换显式API模式尾随逗号break和continue类型推断Kotlin 1.2数学运算API序列操作集合操作反射改进KotlinSecurity RisksStatic TypeException HandlingOWASP Mobile TOP 10Kotlin 1.3multiplatform projectsbehavioral-incompatiblesource-incompatibleKotlin/JVMKotlin/NativeKotlin/JSK2编译器兼容性指南构造函数静态函数数据类型单利模式算法数据结构复杂度分析数据结构分类算法类型Kotlin 多平台1.9.10新特性翻译同步













