# requireNotNull or "!​!"?

**URL:** <https://discuss.kotlinlang.org/t/requirenotnull-or/1562>\
**Category:** Language Design\
**Created:** [March 28, 2016, 9:06am UTC](https://discuss.kotlinlang.org/t/requirenotnull-or/1562 "2016-03-28T09:06:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lhornyak](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lhornyak/32/1665_2.png) [@lhornyak](https://discuss.kotlinlang.org/u/lhornyak)\
**Post date:** [March 28, 2016, 9:06am UTC](https://discuss.kotlinlang.org/t/requirenotnull-or/1562/1 "2016-03-28T09:06:15Z")

</div>

hi Kotlin Team,

Is there a general guideline, when should one use requireNotNull and when “!!” to enforce notnullness?

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [March 28, 2016, 12:42pm UTC](https://discuss.kotlinlang.org/t/requirenotnull-or/1562/2 "2016-03-28T12:42:28Z")

</div>

I would say that requireNotNull() is best used for parameter validation (if you can’t simply use a non-null type - for example, if the contract of your function is "if parameter X is not null, parameter Y must be not null as well). In all other cases, it’s better to use !! because it’s more concise and easier fits into the middle of an expression.
