@Override public void flatMap(WindowedValue<IN> value, Collector<WindowedValue<OUTFL>> out) throws Exception { this.initContext(doFn, out); // for each window the element belongs to, create a new copy here. Collection<? extends BoundedWindow> windows = value.getWindows(); if (windows.size() <= 1) { processElement(value); } else { for (BoundedWindow window : windows) { processElement( WindowedValue.of(value.getValue(), value.getTimestamp(), window, value.getPane())); } } }