I'm exploring a Swagger-generated Java API. In the generated client file, I see two methods like this:
public Observable<UserAccountView> createUserAccount(/* params omitted */) {
/* body omitted */
}
public UserAccountView createUserAccountSynchronously(/* params omitted */) {
return createUserAccount(/*params*/).toBlocking.single();
}
I've read the RxJava docs and related resources but since I'm new to this I still find myself thinking toBlocking shouldn't be needed here-- doesn't blocking/non-blocking lose its meaning for a Single? Is there such a thing as a blocking Single?
Clearly I'm not fully grasping the relationship between the two methods. I am thinking that single() is extracting a singular event from an observable before unsubscribing. Why should toBlocking be needed in order to do that?