balanceqosa.blogg.se

Kotlin map not null
Kotlin map not null












kotlin map not null

However, beware that if the nullable type does contain a null value you’ll get a null pointer exception during this process: > val s1: String? = null If you’re 100% certain that a nullable type doesn’t contain a null value, you can convert it to its non-nullable equivalent, like this: > val s1: String? = "Christina" The official name of this operator is the “Non-null assertion operator.” Examples It lets you convert a nullable type to its non-nullable equivalent, such as converting a String? to a String, and it should only be used when you are 100% certain that a nullable type isn’t null. Kotlin also includes an operator generally known as the Force Operator.














Kotlin map not null