public StreamEvent poll() {
        reset();
        if (first != null) {
            StreamEvent firstEvent = first;
            first = first.getNext();
            firstEvent.setNext(null);

            if (!isFullSnapshot()) {
                if (isOperationLogEnabled) {
                    operationChangeLog.add(new Operation(Operator.REMOVE));
                }
                operationChangeLogSize++;
            } else {
                operationChangeLog.clear();
                operationChangeLogSize = 0;
                forceFullSnapshot = true;
            }
            return firstEvent;
        } else {
            return null;
        }
    }
Returns the next element in the iteration.

@return the next element in the iteration.
@throws NoSuchElementException iteration has no more elements.
modules/siddhi-core/src/main/java/io/siddhi/core/event/stream/holder/SnapshotableStreamEventQueue.java