public static < T > Observable < T > toHotObservable ( final List < ComposableFuture < T > > futures , final boolean failOnError ) { final ReplaySubject < T > subject = ReplaySubject . create ( futures . size ( ) ) ; final AtomicInteger counter = new AtomicInteger ( futures . size ( ) ) ; final AtomicBoolean errorTrigger = new AtomicBoolean ( false ) ; for ( final ComposableFuture < T > future : futures ) { future . consume ( provideObserverResult ( subject , counter , errorTrigger , failOnError ) ) ; } return subject ; }
translate a list of eager futures into a hot Observable stream the results of the futures will be stored in the stream for any future subscriber .