An Optional's place in Kotlin

1 · Jake Wharton · May 14, 2017, midnight
With nullability being a first-class citizen in Kotlin’s type system, the need for an Optional type seems all but diminished. Just because you can explicitly express nullability, however, does not mean that null is always allowed. For example, Retrofit provides adapters for RxJava 1.x and 2.x which allow modeling your requests as a single-element stream. interface MyApiService { @GET("/api/user/settings") fun userSettings(): Observable<Settings> } RxJava 2 differs from RxJava 1 in that it d...