Collection.isNullOrEmpty()


#1

String class has the very useful “String?.isNullOrEmpty()” (and friends) – why not Collection?


#2

It’s simple enough to hack together such a utility function for your own use. And if you feel really strongly that it should be in the standard library, that’s what pull requests are for :smiley:


#3

Yeah, I’ve done so for my project, but it feels generally useful. Partly just wanted to check that there wasn’t some reason I’m missing why this doesn’t exist already.


#4

Fair enough. Perhaps the community ought to start something akin to Guava… shared util functions that perhaps ought to be in the std lib, but without necessarily having to go through the rigor of making that happen. Goodness knows I’ve got a half dozen things I could throw into a project like that…