List of usage examples for org.apache.commons.functor.core.algorithm FoldLeft FoldLeft
public FoldLeft(BinaryFunction<? super T, ? super T, ? extends T> func)
From source file:org.apache.commons.functor.example.kata.four.DataMunger.java
/** * Processes each line of the given Reader, returning the <i>selected</i> column for the * line where the absolute difference between the integer value of <i>col1</i> and <i>col2</i> * is least. Note that lines that don't begin with an Integer are ignored. */// w ww . jav a 2 s . c om public static final Object process(final Reader file, final int selected, final int col1, final int col2) { return NthColumn.instance(selected) .evaluate(new FoldLeft<String>(lesserSpread(col1, col2)).evaluate(new FilteredGenerator<String>( Lines.from(file), Composite.predicate(IsInteger.instance(), NthColumn.instance(0))))); }