`?: throw`/`checkNotNull`/`requireNotNull` can be better than
!!
in some situations, such as when providing a detailed message, because Kotlin doesn't. https://youtrack.jetbrains.com/issue/KT-6989
but that doesn't apply to that code snippet 😞
s
Sam
01/24/2023, 10:26 PM
And maps have
getValue
too, but I'd have to check how useful its message is. I've never been quite sure whether it's actually intended to be used at all on non-defaulted maps...
e
ephemient
01/24/2023, 10:29 PM
getValue
throws
NoSuchElementException("Key $key is missing in the map.")