@Override
        public Object processAdd(Object data) {
            Integer value = (Integer) data;
            if (maxDeque != null) {
                for (Iterator<Integer> iterator = maxDeque.descendingIterator(); iterator.hasNext(); ) {
                    if (iterator.next() < value) {
                        iterator.remove();
                    } else {
                        break;
                    }
                }
                maxDeque.addLast(value);
            }
            if (maxValue == null || maxValue < value) {
                maxValue = value;
            }
            return maxValue;
        }
The initialization method for FunctionExecutor

@param attributeExpressionExecutors are the executors of each attributes in the function
@param processingMode               query processing mode
@param outputExpectsExpiredEvents   is expired events sent as output
@param configReader                 this hold the {@link MaxAttributeAggregatorExecutor} configuration reader.
@param siddhiQueryContext           Siddhi query runtime context
modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/MaxAttributeAggregatorExecutor.java