Aug 31, 2018 · 1 min read
Great article, I just have one problem with it:
“Using var is not forbidden, nor is !! or ?.”
I agree with you on not using the first two, the last one though, ?… that’s something I use all the time, sometimes values can be null, and that’s ok.
The ? just makes you think about whether you should expect null and if so, handle it appropriately.
!! I use a little in unit tests, primarily out of laziness. var I try and avoid at all costs. The one exception is Dagger DI where lateinit var is needed to inject into framework classes like Activity and Fragment subclasses.