Search code examples
javakotlinreactivereactivex

What is a Single<Int>! and how can I instantiate a variable as it


I'm trying to solve some test issues and I'm getting the error:

The integer literal does not conform to the expected type Single!

I've never worked with Single<> and I haven't been able to found how to instantiate a variable as one in Kotlin.


Solution

  • Found that the Single is a class from Reactivex and the way to create a variable as Single is:

    Single.just(1)
    

    And you can replace the "1" with what you want as the variable.