July 2018
Intermediate to advanced
242 pages
8h 6m
English
While working with poorly designed APIs of servers or external libraries, we often need to deal with receiving null return values. Thankfully, there are a number of standard library features that allow us to handle null values effectively. In this recipe, we are going to implement a data preprocessing operation which will remove all the nulls from the dataset automatically. Let's say we are working with an external API that provides us with the latest news feed. Unfortunately, it's not null-safe and can return random null values. For example, let's assume we have a getNews(): List<News> function that returns the following data:
fun getNews() = listOf( News("Kotlin 1.2.40 is out!", "https://blog.jetbrains.com/kotlin/" ...
Read now
Unlock full access