poohbar
04/17/2018, 12:13 PM!! on .min() or .max() calls where I know the collection is not empty. I kind of wish we had a NonEmptyList that would return non-nullable types from such functions. Do you guys have a better way to handle this?benleggiero
04/17/2018, 12:16 PM.min()dalexander
04/17/2018, 12:25 PM?: for your fallback value). Or you could stick with !! you’ll get some kind of exception if you ever do have an empty list, which I think is fine because you’re expecting something not empty?poohbar
04/17/2018, 12:32 PMmin(), max() already return null for empty lists AFAIKpoohbar
04/17/2018, 12:33 PMmyList.min() ?: 0
// or
myList.min()!!
but both seem ugly when I know 100% that the list is not empty, maybe because it's in a local variable that I have just initialized with values one row above.benleggiero
04/17/2018, 12:37 PM.fooOrNull() here, but also personally, I wish "or null" was the default (like these) instead of the current "or crash"poohbar
04/17/2018, 12:42 PMgildor
04/17/2018, 2:44 PMfun List<Int>.minOrZero() = min ?: 0gildor
04/17/2018, 2:44 PMdiego-gomez-olvera
04/17/2018, 6:59 PM