id: 161 View:category
Tutorials  Language
Tutorials  Language  Kotlin

First class support throughout

Hardcore Android developers have been aware Koltin could be used alongside Java for some time, but many have been held back by the lack of official support. That ended at Google I/O 2017, when it was announced it will now be fuly supported from Android Studio 3.0 onwards, and that's right through from the IDE syntax checkers to the Gradle build system and beyond.

How has Kotlin been implemented on Android?

Since Android is powered at it's heart by a JVM, that's Java Virtual Machine, in theory, anything which can create the bytecode it expects can be used to run software on it. Koltin is such a beast, and AS 3.0 now has the toolchain needed to generate it. So it's a hat tip to the designers of the original JVM for creating a system with such longevity.

Uniquely, Kotlin is not an "all or nothing" swap in for Java, the way other languages would be (or at least not without a few very complicated hoops to jump through). It actually sits side by side in the source tree and is even interoperable with Java, so it can call Java methods directly and vice-versa. Migrating existing projects over just lost what is traditionally the largest hurdle they face.

Tutorials  Language  RxJava

ReactiveX corner cases

Whether you’re new to RxJava, or have used it for a while, there’s always something new to learn. While using the framework, I learned 5 not so obvious things about RxJava that helped me maximize its potential.

This article references APIs that are available in RxJava 1.2.6

1. When to use map or flatMap

Map and flatMap are two commonly used ReactiveX operators. They’re often the first two operators you learn, and it can be confusing to figure out which one’s the right one to use.
Both map and flatMap apply a transformational function on each item emitted by an Observable. However, map only emits one item, whereas flatMap emits zero or more items.

In this example, the map operator applies the split function to each string and emits one item containing an array of strings. Use this when you want to transform one emitted item into another.

Full article