Coroutines in KotlinCoroutines in Kotlin Andrey.Breslav@JetBrains.com This talk could have been named… • async/await/yield • fibers • [stackless] continuations Suspendable Computations 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 saying is no more Stackful Language restrictions Use in special contexts L Use anywhere J Implemented in C#, Scala, Kotlin, … Quasar, Javaflow, … Code transformation Local (compiler magic) J All over the place L Runtime0 码力 | 39 页 | 1.01 MB | 1 年前3
Kotlin Language Documentation 1.9.20Kotlin Language Documentation 1.9.20 Table of Contents Kotlin Docs Get started with Kotlin Install Kotlin Create your powerful application with Kotlin Is anything missing? Welcome to our tour of of Kotlin! Hello world Variables String templates Practice Next step Basic types Practice Next step Collections List Set Map Practice Next step Control flow Conditional expressions Ranges calls Use Elvis operator Practice What's next? Kotlin Multiplatform Kotlin Multiplatform use cases Code sharing between platforms Get started Kotlin for server side 77 78 78 79 79 79 80 830 码力 | 1299 页 | 32.44 MB | 1 年前3
A Security Guide for Kotlin Developers.........................1 Kotlin’s Security Profile............................................2 Most Common Security Attacks...............................3 Top Kotlin Security Risk.............. ......10 Protect Your Kotlin Programs with Kiuwan.............. 11 1 A pragmatic, modern, and statically typed coding language that’s essentially a Java alternative, Kotlin offers some key benefits Virtual Machine (JVM) and Android app development while also being interoperable alongside Java. Kotlin language is general purpose and open sourced—available on GitHub for anyone to use—combining functional0 码力 | 13 页 | 1.80 MB | 1 年前3
Kotlin Language Documentation 1.3Kotlin Language Documentation Table of Contents Overview Using Kotlin for Server-side Development Using Kotlin for Android Development Kotlin JavaScript Overview Kotlin/Native for Native Kotlin asynchronous programming and more Multiplatform Programming What's New in Kotlin 1.1 What's New in Kotlin 1.2 What's New in Kotlin 1.3 Standard library Tooling Getting Started Basic Syntax Idioms Functions and Lambdas Functions Higher-Order Functions and Lambdas Inline Functions Collections Kotlin Collections Overview Constructing Collections Iterators Ranges and Progressions Sequences Collection0 码力 | 597 页 | 3.61 MB | 1 年前3
Kotlin 1.4 language featuresKotlin 1.4 Online Event October 12, 2020 @sveta_isakova Kotlin 1.4 Language Features Svetlana Isakova Kotlin 1.4 Language Features • SAM conversions for Kotlin classes • Explicit API mode 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 Ability println("I'm Kotlin 1.3") } SAM conversion for a Java interface public interface Action { void run(); } public static void runAction(Action action) { action.run(); } Java: Kotlin: runAction0 码力 | 69 页 | 3.29 MB | 1 年前3
Kotlin 1.2 Language DocumentationKotlin Language Documentation Table of Contents Overview Using Kotlin for Server-side Development Using Kotlin for Android Development Kotlin JavaScript Overview Kotlin/Native for Native Coroutines asynchronous programming and more Multiplatform Programming What's New in Kotlin 1.1 What's New in Kotlin 1.2 What's Coming in Kotlin 1.3 Standard library Tooling Getting Started Basic Syntax Idioms structure Java Interop Calling Java code from Kotlin Calling Kotlin from Java JavaScript Dynamic Type Calling JavaScript from Kotlin Calling Kotlin from JavaScript JavaScript Modules JavaScript0 码力 | 333 页 | 2.22 MB | 1 年前3
Hello 算法 1.1.0 Kotlin版Hello 算法 Kotlin 语言版 作者:靳宇栋(@krahets) 代码审阅:陈东辉(@curtishd) Release 1.1.0 2024‑04‑15 序 两年前,我在力扣上分享了“剑指 Offer”系列题解,受到了许多读者的鼓励和支持。在与读者交流期间,我 最常被问的一个问题是“如何入门算法”。逐渐地,我对这个问题产生了浓厚的兴趣。 两眼一抹黑地刷题似乎是最受欢迎的方法 maxHeap.add(_val) // 从底至顶堆化 siftUp(size() - 1) } /* 从节点 i 开始,从底至顶堆化 */ fun siftUp(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 获取节点 i 的父节点 val p = parent(i) // 当“越过根节点”或“节点无须修复”时,结束堆化 从顶至底堆化 siftDown(0) // 返回堆顶元素 return _val } /* 从节点 i 开始,从顶至底堆化 */ fun siftDown(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 判断节点 i, l, r 中值最大的节点,记为 ma val l = left(i) val0 码力 | 381 页 | 18.47 MB | 1 年前3
Kotlin 入门学习笔记整理final 修饰的静态变量的字符串,是个编译器常量(编译器编译的时候,已经确定并且不可改变的) 1 private static final String LALALA = "lalala"; kotlin 中的表示⽅式 1 companion object { 2 const val LALALA = "lalala" 3 } 定义变量 变量名后 “:” 跟着他的类型,类型可以省略掉 2 ... 3 } 创建对象(直接调⽤构造器) 1 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 | 1 年前3
Hello 算法 1.2.0 简体中文 Kotlin 版Hello 算法 Kotlin 语言版 作者:靳宇栋(@krahets) 代码审阅:陈东辉(@curtishd) Release 1.2.0 2024‑12‑06 序 两年前,我在力扣上分享了“剑指 Offer”系列题解,受到了许多读者的鼓励和支持。在与读者交流期间,我 最常被问的一个问题是“如何入门算法”。逐渐地,我对这个问题产生了浓厚的兴趣。 两眼一抹黑地刷题似乎是最受欢迎的方法 maxHeap.add(_val) // 从底至顶堆化 siftUp(size() - 1) } /* 从节点 i 开始,从底至顶堆化 */ fun siftUp(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 获取节点 i 的父节点 val p = parent(i) // 当“越过根节点”或“节点无须修复”时,结束堆化 从顶至底堆化 siftDown(0) // 返回堆顶元素 return _val } /* 从节点 i 开始,从顶至底堆化 */ fun siftDown(it: Int) { // Kotlin 的函数参数不可变,因此创建临时变量 var i = it while (true) { // 判断节点 i, l, r 中值最大的节点,记为 ma val l = left(i) val0 码力 | 382 页 | 18.48 MB | 10 月前3
Hello 算法 1.2.0 繁体中文 Kotlin 版Hello 演算法 Kotlin 語言版 作者:靳宇棟(@krahets) 程式碼審閱:陳東輝(@curtishd) Release 1.2.0 2024‑12‑06 序 兩年前,我在力扣上分享了“劍指 Offer”系列題解,受到了許多讀者的鼓勵與支持。在與讀者交流期間,我 最常被問到的一個問題是“如何入門演算法”。漸漸地,我對這個問題產生了濃厚的興趣。 兩眼一抹黑地刷題似乎是最受歡 maxHeap.add(_val) // 從底至頂堆積化 siftUp(size() - 1) } /* 從節點 i 開始,從底至頂堆積化 */ fun siftUp(it: Int) { // Kotlin 的函式參數不可變,因此建立臨時變數 var i = it while (true) { // 獲取節點 i 的父節點 val p = parent(i) // 當“越過根節點”或“節點無須修復”時,結束堆積化 從頂至底堆積化 siftDown(0) // 返回堆積頂元素 return _val } /* 從節點 i 開始,從頂至底堆積化 */ fun siftDown(it: Int) { // Kotlin 的函式參數不可變,因此建立臨時變數 var i = it while (true) { // 判斷節點 i, l, r 中值最大的節點,記為 ma val l = left(i) val0 码力 | 382 页 | 18.79 MB | 10 月前3
共 268 条
- 1
- 2
- 3
- 4
- 5
- 6
- 27













