3, 1)<br>var result: NotEmptySet&lt;Int&gt; = collection.toNotEmptySetOrThrow()<br>println(result) // [1, 2, 3]<br><br>collection = emptySet()<br>collection.toNotEmptySetOrThrow() // IllegalArgumentException</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></div></span></div><p class="paragraph">Please note that changes made to the original collection will not