Top "Kotlin-null-safety" questions

Best way to null check in Kotlin?

Should I use double =, or triple =? if(a === null) { //do something } or if(a == null) { //do something } Similarly for 'not …

kotlin kotlin-null-safety
What is the Kotlin double-bang (!!) operator?

I'm converting Java to Kotlin with Android Studio. I get double bang after the instance variable. What is the double …

kotlin kotlin-null-safety
Idiomatic way of handling nullable or empty List in Kotlin

Say I have a variable activities of type List<Any>?. If the list is not null and not …

kotlin idioms kotlin-null-safety
Only safe or non null assserted calls are allowed on a nullable receiver type of arraylist

Just started using kotlin for android development.My arraylist is declared like this- var day1: ArrayList<DietPlanDetailModel>? = null …

android kotlin kotlin-null-safety
How to run code if object is null?

In Kotlin, I can run code if an object is not null like this: data?.let { ... // execute this block if …

kotlin kotlin-null-safety
how to use spring annotations like @Autowired or @Value in kotlin for primitive types?

Autowiring a non-primitive with spring annotations like @Autowired lateinit var metaDataService: MetaDataService works. But this doesn't work: @Value("\${cacheTimeSeconds}") lateinit …

spring kotlin kotlin-interop kotlin-null-safety
How to idiomatically test for non-null, non-empty strings in Kotlin?

I am new to Kotlin, and I am looking for help in rewriting the following code to be more elegant. …

kotlin kotlin-null-safety
Kotlin call function only if all arguments are not null

Is there a way in kotlin to prevent function call if all (or some) arguments are null? For example Having …

kotlin kotlin-null-safety
Is `a?.let{} ?: run{}` idiomatic in Kotlin?

I saw the following comment in a S.O. post, and I'm intrigued: why don't you use if for null …

kotlin kotlin-null-safety