All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.basking2.sdsai.itrex.functions.LastFunction Maven / Gradle / Ivy

There is a newer version: 1.1.23
Show newest version
package com.github.basking2.sdsai.itrex.functions;

import com.github.basking2.sdsai.itrex.EvaluationContext;

import java.util.Iterator;

/**
 * Evaluate all arguments, but only return the value of the last element.
 */
public class LastFunction implements FunctionInterface {
    
    @Override
    public Object apply(final Iterator objectIterator, final EvaluationContext evaluationContext) {
        Object o = null;

        while (objectIterator.hasNext()) {
            o = objectIterator.next();
        }

        return o;
    }

}