What is the Kotlin double-bang !! operator?
What is the Kotlin double-bang !! operator?
The Kotlin double-bang !! operator is used to assert that a nullable value is not null and convert it to a non-nullable type. It is also known as the "not-null assertion operator".
When you use the double-bang operator on a nullable value, you are telling the compiler that you know for sure the value is not null and it is safe to access its properties or methods. However, if the value is actually null, a NullPointerException will be thrown at runtime.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.