3 ms·
Kotlin has a less good backward compatibility record and interacts awkwardly with newer JVM/standard library features - e.g. streams are cumbersome to work with
by lmm 3y ago
Kotlin has a less good backward compatibility record and interacts awkwardly with newer JVM/standard library features - e.g. streams are cumbersome to work with because Kotlin has a different approach to absence/nullability. Async in particular is a place where Kotlin has gone through multiple incompatible rewrites and is doing something that's not necessarily going to align with the JVM way of doing things in the future (Project Loom - which I have my own doubts about, but if you believe in it then that's definitely a reason to use Java over Kotlin).
(Plus if you're going to go to the trouble of using a non-Java language it would be a real waste to use Kotlin over Scala)
- ptx 3y ago> streams are cumbersome to work with because Kotlin has a different approach to absence/nullability I'm not sure that's a reason to pick Java over Kotlin though – streams are just generally cumbersome, even in Java, compared to Kotlin's sequences. By choosing Java you're getting more exposure to them whereas in Kotlin you can mostly avoid them in favor of sequences.
- lmm 3y agoStreams are less cumbersome in Java because you can use optional everywhere and it's relatively idiomatic; the ecosystem (at least the modern parts of it) will support you in doing so. Whereas in Kotlin everything expects you to use their special nullables and so you have to constantly shift back and forth.
- rhdunn 3y agoI've had the opposite experience. I've found using Optional/map everywhere harder to read than Kotlin nullable types. And I find Kotlin streams/streaming API easier to read and use/more intuitive than Java's equivalent.