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




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:




The "Sample Code" link os broken!

Thanks for letting me know, Rodrigo. I'm not sure why that doesn't work (I swear it used to!) but this one should definitely work:

I'll update the link above. Thanks!

Thanks Craig!


Lessons in RxJava