News for hackers. Stuff that matters.

driver733

Re:Kotlin vs. Java on Monday December 16, 2019 @06:00PM (#21808460)
That's not always the case, since Kotlin can generate Java 6 compatible bytecode.
Re:Kotlin vs. Java on Monday December 16, 2019 @05:49PM (#21808335)
I completely agree. I'll make that change soon.

Thanks for the feedback.

Re:Kotlin vs. Java on Monday December 16, 2019 @05:39PM (#21808222)
It can be done this way:

  result = Optional.ofNullable(nullableVariable)
                   .map(NullableType::someMethodCall)
                   .orElseGet(() -> fallbackIfNullMethodCall());
Re:Kotlin vs. Java on Monday December 16, 2019 @05:35PM (#21808175)
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.
Re:Kotlin vs. Java on Monday December 16, 2019 @05:26PM (#21808087)
Re:Kotlin vs. Java on Monday December 16, 2019 @05:23PM (#21808045)
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.

Re:Kotlin vs. Java on Monday December 16, 2019 @05:13PM (#21807927)
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.
Re:Kotlin vs. Java on Monday December 16, 2019 @05:04PM (#21807835)
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.
Re:Kotlin vs. Java on Monday December 16, 2019 @05:01PM (#21807805)
You are right, but you still have to catch the checked IOException.
Re:Kotlin vs. Java on Monday December 16, 2019 @04:53PM (#21807700)
They will. I am in the process of updating Java code snippets to Java 11.
Re:Kotlin vs. Java on Monday December 16, 2019 @04:52PM (#21807673)
To be more precise, I would say that expressive code == good code