Related: I have been converting Java to Kotlin as ...
# getting-started
t
Related: I have been converting Java to Kotlin as well. And I wonder how others handle the general case of a collection variable. Should we make it nullable, and do all the following ?., !!, etc. or perhaps better to make it a non-nullable empty collection, thus ridding yourself of ?., !!, etc. For example: var items: mutableListOf<Int>? = null // or var items = mutableListOf<Int>() Seems to me the latter results in less and cleaner code, even though it could waste a few bytes of memory that may never be used. Perhaps a Kotlin style guide or something?