Right now, I am using the following function to do this check
if(list.isNullOrEmpty().not()) { doSomething()} else { dont()}
To me, I feel there would be a shorter method to achieve the same like neitherNullNorEmpty()
or just isNotEmpty()
(current isNotEmpty takes non-nullable list). Something along the lines of CollectionUtils.isNotEmpty(list)
which looks cleaner. Right now either I have to add not()
at the end or "!", which doesn't look right as I feel there should be a single function to do this. Such a function will make the code more concise and easier to read. Am I missing something or Kotlin is?