Kotlin: IsNotEmpty() is not !IsNullOrEmpty()

One day, I saw this code in a code review. It looks odd as it is a NOT of Empty.

val hasNoString = !someString.isNullOrEmpty()

What comes to my mind is, this is essentially should be just.

val hasNoString = someString.isNotEmpty()

Looks logical right? When a string is not empty, it is definitely not null right?




Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Recommended from Medium

Oracle APEX shared LOV custom static parameter (or passing parameters via HTTP headers)

Game Dev in Progress… Day 28

Mobile App Acceptance Testing using JavaScript on Local & BrowserStack Environments with WebDriver.I

Single Responsibility Principle (SRP)

Permission-based access in Google Firestore

How to Make Software Outsourcing Work With Agile Development

My journey to Performance Analysis 2/2 (HAR files)

C# Drills for Interview Preparation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Sharing Software Development Experience, focus on Mobile. https://elye-project.medium.com/subscribe https://twitter.com/elye_project

More from Medium

Configuring Scheduled Notifications in Android

Setting UserAgent in Android Webview

How To Implement The Activity Result API TakePicture Contract With Uri Return Type

Jetpack DataStore in Modern Android Development