k lang-kotlin" theme="idea">var map: Map&lt;Char, Int&gt; = mapOf('a' to 1, 'b' to 2)<br>var notEmptyMap: NotEmptyMap&lt;Char, Int&gt;? = map.toNotEmptyMap()<br>    .getOrNull()<br>assertNotNull(notEmptyMap)<br>map = emptyMap()<br>notEmptyMap = map.toNotEmptyMap()<br>    .getOrNull()<br>assertNull(notEmptyMap)</code></pre><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span><