I am new to Kotlin. I want to know the difference between this two !!
and ?
in below code.
Below, there are two snippets: the first uses
this is '!!' double-bang operator is always return not-null value and this is '?' safe call operator returns value if value is not null, and null otherwise
This is unsafe nullable type (T?) conversion to a non-nullable type (T). It will throw NullPointerException if the value is null.
It is documented here along with Kotlin means of null-safety.
ref - hotkey