| net.sf.jga.fn.algorithm.ForEach
ForEach | public class ForEach extends UnaryFunctor,R> (Code) | | Applies a UnaryFunctor to each element in an iteration, and returns the
final result. Each element in the iteration is passed to the functor in
turn. The result of the final call to the functor is returned. If the
iteration was empty, then the result of this function is null.
Copyright © 2003-2005 David A. Hall
author: David A. Hall |
Constructor Summary | |
public | ForEach(UnaryFunctor<T, R> fn) Builds a ForEach functor that will use the given functor to process
elements in an iteration. |
Method Summary | |
public void | accept(net.sf.jga.fn.Visitor v) Calls the Visitor's visit(ForEach) method, if it
implements the nested Visitor interface. | public R | fn(Iterator<? extends T> iterator) Apply the functor to each element in the iteration and return the final
result. | public UnaryFunctor<T, R> | getFunction() Returns the functor used to process elements in an iteration. | public String | toString() |
serialVersionUID | final static long serialVersionUID(Code) | | |
accept | public void accept(net.sf.jga.fn.Visitor v)(Code) | | Calls the Visitor's visit(ForEach) method, if it
implements the nested Visitor interface.
|
fn | public R fn(Iterator<? extends T> iterator)(Code) | | Apply the functor to each element in the iteration and return the final
result.
the result of the last execution of the functor, or null if thefunctor is not executed. |
getFunction | public UnaryFunctor<T, R> getFunction()(Code) | | Returns the functor used to process elements in an iteration.
|
|
|