-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2019-12-02:Kotlin中该如何安全地处理可空类型? #201
Comments
a?.let{ } |
not know |
对于方法传入的参数直接通过if判断,例如:
还有就是
然后接着有一个疑问,假如同时判断两个变量,写成:
这样似乎有点不够优雅,想看看大家有什么优雅的写法 |
takeif |
补充一点,尽量不要出现空,也就不需要处理空,参考 Java 的空对象模式 |
fun <T1, T2> ifNotNull(value1: T1?, value2: T2?, bothNotNull: (T1, T2) -> (Unit)) { |
No description provided.
The text was updated successfully, but these errors were encountered: