?.let vs if not null

Variables in Kotlin are not any more volatile than they are in Java. They certainly don’t get the volatile keyword. Kotlin does however try to be thread-safe by default though as long as you don’t break your thread safety yourself (you need to provide some sort of synchronization (volatile, synchronized, locks)).

3 Likes