@Override protected void doNext(Event<T> ev) { if (null == acc) { acc = (null != accumulators ? accumulators.get() : null); } acc = fn.apply(Tuple2.of(ev.getData(), acc)); }
/** * Attach a Stream to the {@link Observable} with the specified {@link Selector} and key. * * @param observable * the {@link Observable} to observe * @param acceptSelector * the {@link Selector}/{@literal Object} tuple to listen to * @param key * the key to publish to * @param <T> * the type of values passing through the {@literal Stream} * * @return a new {@link DeferredStreamSpec} * @since 1.1 */ public static <T> Stream<T> on(Observable observable, Selector acceptSelector, Object key) { return new StreamSpec<T>().observable(observable).acceptSelector(Tuple2.of(acceptSelector,key)).get(); }