- Android Development with Kotlin
- Marcin Moskala Igor Wojda
- 110字
- 2021-07-02 18:48:35
Smart casts
Smart casting converts a variable of one type to another type, but as opposed to safe casting, it is done implicitly (we don't need to use the as or as? cast operator). Smart casts work only when the Kotlin compiler is absolutely sure that the variable will not be changed after checking. This makes them perfectly safe for multithreaded applications. Generally, smart casts are available for all immutable references (val) and for local mutable references (var). We have two kinds of smart cast:
- Type smart casts cast an object of one type to an object of another type
- Nullity smart casts cast nullable references to non-nullable
推薦閱讀
- FreeSWITCH 1.8
- Mastering Selenium WebDriver
- Android Studio Essentials
- GitLab Repository Management
- 用Flutter極速構建原生應用
- Ext JS 4 Web Application Development Cookbook
- 軟件品質之完美管理:實戰經典
- PHP+Ajax+jQuery網站開發項目式教程
- INSTANT Yii 1.1 Application Development Starter
- C++編程兵書
- Orleans:構建高性能分布式Actor服務
- SEO教程:搜索引擎優化入門與進階(第3版)
- Hands-On Dependency Injection in Go
- 系統分析師UML用例實戰
- Learning Swift