Wrong values from string empty test (java x kotlin)

I'm having a super weird behavior from a code that I was testing. The test I wrote was to see the behavior of the class if the Android returned an empty package name. After some debug I found this (consider that packageName is ""):

val resultFromKotlin = packageName.isNullOrEmpty()

val resultFromJava = StringUtils.isEmpty(packageName)

Is this expected? Can someone tell what the deal with this?

ps1.: In the picture above, Android Studio was complaining of isNullOrEmpty saying that could be simplified, since packageName can't be null at that point

ps2.: For references:

The StringUtils class is written...

Read More »

By: StackOverFlow - 6 days ago

Related Posts