- 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.
推薦閱讀
- ClickHouse性能之巔:從架構(gòu)設(shè)計(jì)解讀性能之謎
- JIRA 7 Administration Cookbook(Second Edition)
- Web Development with Django Cookbook
- 新手學(xué)Visual C# 2008程序設(shè)計(jì)
- Cassandra Data Modeling and Analysis
- Python機(jī)器學(xué)習(xí)實(shí)戰(zhàn)
- Learning OpenStack Networking(Neutron)
- PLC應(yīng)用技術(shù)(三菱FX2N系列)
- 智能手機(jī)APP UI設(shè)計(jì)與應(yīng)用任務(wù)教程
- 一本書講透Java線程:原理與實(shí)踐
- INSTANT JQuery Flot Visual Data Analysis
- 人人都能開發(fā)RPA機(jī)器人:UiPath從入門到實(shí)戰(zhàn)
- 精通Spring:Java Web開發(fā)與Spring Boot高級功能
- Clojure Web Development Essentials
- MongoDB Cookbook