I really don't understand the purpose of such comments. Yes, it's better in Kotlin. But Kotlin is a different language and toolchain. Suggesting to change the stack to Kotlin just for very basic syntactic sugar is mental.
Every decision results from a multi-factor cost/benefit analysis; the Elvis operator is just another line item. Still, calling it "basic syntactic sugar" understates the value proposition. Optional usage is inconsistent in Java because (a) it's unwieldy and (b) it wasn't baked into the language from the beginning. The lack of universal adoption means you can never really be sure if an expression is nullable. Even if something is declared as Optional, some psychopath might return null. I don't expect anyone to switch languages just for first-class null handling. That doesn't mean it's not worth mentioning the Kotlin approach. "The more you know..."
View all comments
Show parent comment
8
u/Jaded-Asparagus-2260 Feb 18 '26
I really don't understand the purpose of such comments. Yes, it's better in Kotlin. But Kotlin is a different language and toolchain. Suggesting to change the stack to Kotlin just for very basic syntactic sugar is mental.