RxKotlin revolves around the observable type that represents a system of data/events intended for push mechanism (instead of the pull mechanism of the iterator pattern of traditional programs), thus it is lazy and can be used synchronously and asynchronously.
It will be easier for us to understand if we start with a simple example that works with a list of data. So, here is the code:
fun main(args: Array<String>) { var list:List<Any> = listOf("One", 2, "Three", "Four", 4.5, "Five", 6.0f) // 1 var iterator = list.iterator() // 2 while (iterator.hasNext()) { // 3 println(iterator.next()) // Prints each element 4 } }
The following screenshot is the output:
So, let's go through the ...