/** {@inheritDoc} */ @Nullable @Override public Map<String, Collection<?>> run(GridStreamerContext ctx, Collection<Quote> quotes) throws GridException { GridStreamerWindow win = ctx.window("stage1"); // Add numbers to window. win.enqueueAll(quotes); Collection<Quote> polled = win.pollEvictedBatch(); if (!polled.isEmpty()) { Map<String, Bar> map = new HashMap<>(); for (Quote quote : polled) { String symbol = quote.symbol(); Bar bar = map.get(symbol); if (bar == null) map.put(symbol, bar = new Bar(symbol)); bar.update(quote.price()); } return Collections.<String, Collection<?>>singletonMap(ctx.nextStageName(), map.values()); } return null; }