Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

CharSequence?.isNullOrBlank()

In java I can make my own static function

isNullOrBlank(String input)

Which works on nulls too, right?

It's annoying to have to reference another class - but otherwise it's not much less ergonomic.



You can, you can even call the kotlin version that way if it happens to be on the classpath, but it's truly horrible ergonomics if for every call you have to guess between class-ref-otherargs and ref-otherargs forms. It's one of those little cuts you grow numb to.


CharSequence is the base class that things like java.lang.String inherit. So I understood that as an instance method you can call like "foo".isNullOrBlank() (in Kotlin syntax)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: