- Functional Kotlin
- Mario Arias Rivu Chakraborty
- 55字
- 2021-06-24 19:15:23
Checking for non-null types
This is similar to the previous one, but it checks directly for the type:
if (nullableCupcake is Cupcake) {
nullableCupcake.eat()
}
It also works with when:
when (nullableCupcake) {
is Cupcake -> nullableCupcake.eat()
}
Both options, checking for null and non-null types, are a little bit verbose. Let's check other options.
推薦閱讀
- Learning Python Web Penetration Testing
- 軟件架構設計:大型網站技術架構與業務架構融合之道
- 樂學Web編程:網站制作不神秘
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- 64位匯編語言的編程藝術
- Serverless架構
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- Cocos2d-x學習筆記:完全掌握Lua API與游戲項目開發 (未來書庫)
- Teaching with Google Classroom
- Apache Spark 2.x for Java Developers
- Mastering Android Development with Kotlin
- Haskell Data Analysis Cookbook
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- Python圖形化編程(微課版)
- R用戶Python學習指南:數據科學方法