Question: I have this code

```
    public Stream<PaymentEntity> getPayments(List<String> paymentIds) {
        return paymentIds.stream()
                .flatMap(id -> paymentsRepository.getById(id))

}

```

`paymentsRepository.getById(id)` is returning `Single<PaymentEntity>`

But i got compile time error

> 
> no instance(s) of type variable(s) R exist so that
>  Single conforms to Stream
> 
> 
> 

Edit, to anyone asking about `Single` <http://reactivex.io/documentation/single.html>

Answer: 
Alternate solution:

```
public Stream<PaymentEntity> getPayments(List<String> paymentIds) {
    return Observable.fromIterable(paymentIds)
            .flatMapSingle(id -> paymentsRepository.getById(id))
            .toList()
            .blockingGet()
            .stream();
}

```
You can wait until the current `Single` in the lambda signals a success value using `.blockingGet()`:

```
return paymentIds.stream()
            .map(id -> paymentsRepository.getById(id).blockingGet());

```

Or you can wait until all the reactive chain signals a success value in this way:

```
return Observable.fromIterable(paymentIds)
            .flatMapSingle(paymentsRepository::getById)
            .toList()
            .blockingGet()
            .stream();

```

Consider also to use `Flowable`: unlike `Observable`, it supports backpressure strategy.