I need to provide some util function that converts a Vertx Future<T>
to Rx Observable<Optional<T>>
for backwards compatibility.
Should this be good enough?
Observable.fromCompletionStage(future.toCompletionStage());
Thanks
No, because Observable.fromCompletionStage
returns Observable<T>
, not Observable<Optional<T>>
.
You must create the Optional
from the future result with ofNullable
:
Observable.fromCompletionStage(future.map(Optional::ofNullable).toCompletionStage());