Sign in Go Pro


RxJava: fromCallable vs defer - The differences between the two operators

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



#Description This lesson describes the similarities and differences between the RxJava `defer` and `fromCallable` operators. The operators are very similar and both can be used to solve the same type of problem: converting an expensive method call into an RxJava Observable. This lesson describes the benefits of each and offers a recommendation on which you should use. ### Summary of Content: - What version of RxJava is required for each operator - Advantages of using fromCallable over defer - How fromCallable can result in writing less code - Why fromCallable provides better error handling - An example problem showing solutions using both fromCallable and defer - How compact the code can become when using Retrolambda ### Other Relevant Links: - -

Lessons in RxJava