driver-async/src/main/com/mongodb/async/client/Observables.java
public static <TResult> Observable<TResult> observe(final Block<SingleResultCallback<TResult>> operation) {
        return new Observable<TResult>() {
            @Override
            public void subscribe(final Observer<? super TResult> observer) {
                new SingleResultCallbackSubscription<TResult>(operation, observer);
            }
        };
    }
public static <TResult> Observable<TResult> observe(final Block<SingleResultCallback<TResult>> operation) {
        return new Observable<TResult>() {
            @Override
            public void subscribe(final Observer<? super TResult> observer) {
                new SingleResultCallbackSubscription<TResult>(operation, observer);
            }
        };
    }
public static < TResult > Observable < TResult > observe ( final Block < SingleResultCallback < TResult > > operation ) { return new Observable < TResult > ( ) { @ Override public void subscribe ( final Observer < ? super TResult > observer ) { new SingleResultCallbackSubscription < TResult > ( operation , observer ) ; } } ; }
Allows the conversion of {@link SingleResultCallback} based operations into an {@link Observable}

<p>Requires a {@link Block} that is passed the callback to be used with the operation.
This is required to make sure that the operation only occurs once the {@link Subscription} signals for data.</p>
<p>
A typical example would be when wrapping callback based methods to make them observable. <br>
For example, converting {@link MongoCollection#count(SingleResultCallback)} into an {@link Observable}:
<pre>
{@code
Observable<Long> countObservable = observe(new Block<SingleResultCallback<Long>>() {
public void apply(final SingleResultCallback<Long> callback) {
collection.countDocuments(callback);
}
});
}
</pre>

@param operation the block that implements the operation.
@param <TResult> The type of result being observed
@return the observable version of the callback based operation
Allows the conversion of { @link SingleResultCallback } based operations into an { @link Observable }