When returning a list of custom objects, RxJava throws an error but compiles

I am making an RxJava call and the end result I subscribed to is a booking list.

The code works fine, but I get this annoying highlight:

enter image description here

The cast doesn't work here because I can't use List <Booking>

to List <Object>

.

Okay, you could say that I should just replace it with a lambda expression, but in a method, call()

I need to call a method that takes List <Booking>

as a parameter:

enter image description here

How can I avoid highlighting in any of these cases?

+3


source to share


1 answer


You can add an explicit type to generic methods such as <Booking>flatMap

. Sometimes Java 8 type inference doesn't work.



+2


source







All Articles