Q: Looking for what I expected Collection.single...
# announcements
d
Q: Looking for what I expected Collection.singleOrNull() would do but doesn't, i.e. return single if 1 element, null if empty and throw if > 1 i.e. equivient to when( size ) { 0 -> null ; 1 -> first() ; 2 -> throw } Is there such a beast ? Its easy to write but maybe Im looking for the wrong words
i
Something like that is discussed in https://youtrack.jetbrains.com/issue/KT-28789