That's not always the case, since Kotlin can generate Java 6 compatible bytecode.
HN user
driver733
Kotlin/Java developer, blogger, OOP and EO (elegantobjects.org) evangelist.
Blog: https://www.driver733.com GitHub: https://github.com/driver733
I completely agree. I'll make that change soon.
Thanks for the feedback.
It can be done this way:
result = Optional.ofNullable(nullableVariable)
.map(NullableType::someMethodCall)
.orElseGet(() -> fallbackIfNullMethodCall());My goal is to compare Kotlin with the current version of Java along with any Java libs that are commonly used (such as Lombok). I have mentioned the fact that some teams are still on older versions of Java just to highlight that not every developer can access the features of the latest Java release.
You might find this article interesting. https://www.pragmaticobjects.com/chapters/001_checked_except...
I leave it to the reader to decide whether the advantages are clear or not.
For instance, in Kotlin you can perform operations on collection without converting them to a stream first, and collecting them with a certain collector afterwards. So in order to perform a single filtering operation on a collection, you need to do three steps in Java and just one in Kotlin.
Another advantage is coroutines, which not only allow you to write asynchronous code in a common, synchronous manner, but also get rid of shared mutable state, since coroutines can send/receive shared state through channels.
Sure, but you have take into account that Android devs are limited to Java 6, most enterprise devs (based on my experience) are still on Java 8 and some are still on Java 5 or below.
It is, however, even in the scope of the "Hello world" app, Kotlin performs much better than Java in terms of bringing out business logic to the front.
You are right, but you still have to catch the checked IOException.
They will. I am in the process of updating Java code snippets to Java 11.
To be more precise, I would say that expressive code == good code