3 ms·
The Elvis Operator is particularly useful because it's such a common pattern in Kotlin, since the language enforces null safety. When you're using a legacy Java
by tjohns 7y ago
The Elvis Operator is particularly useful because it's such a common pattern in Kotlin, since the language enforces null safety. When you're using a legacy Java API without nullability annotations, the language forces you to explicitly handle a null result.
- vinceve 7y agoIt masks the complexity of your statement. I know in ruby we had the same issues with the “try()” method. Our rule was, do or do not, there is no try. :) More info: https://karolgalanciak.com/blog/2017/09/24/do-or-do-not-there-is-no-try-object-number-try-considered-harmful/ https://karolgalanciak.com/blog/2017/09/24/do-or-do-not-ther...
- benibela 7y agoNo, in that case it does not enforce it The Java types become platform types