I'm a Java developer who tried Kotlin and found a counterintuitive case between these two languages.
Consider the given code in Kotlin:
"???".split("") # gives ["", "?", "?", "?", ""]
and the same in Java:
"???".split("") # gives ["?", "?", "?"]
Why does Kotlin produce a leading and trailing empty space string in the resulting array? Or does Java always removes these empty strings, and I just wasn't aware of that?
I know that there is the toCharArray() method on each Kotlin String, but still, it's not very intuitive (maybe the Java developers should give up old habits from Java which they were hoping to reuse in a new language?).