One case where it is needed (often with unsafe casts mixed in) is when writing generic containers of non-null elements (backed by a nullable array)
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
requireNotNull or "!!"? | 1 | 3024 | March 28, 2016 | |
Not-Null Assertion Is Pointless
|
6 | 175 | April 16, 2025 | |
Why does requireNotNull throw an IllegalArgumentException?
|
5 | 5472 | February 15, 2022 | |
?.let vs if not null
|
22 | 452727 | December 20, 2022 | |
Purpose of double exclamation operator (null check) | 4 | 16508 | July 30, 2018 |