Example usage for org.apache.commons.functor.adapter BinaryFunctionFunction BinaryFunctionFunction

List of usage examples for org.apache.commons.functor.adapter BinaryFunctionFunction BinaryFunctionFunction

Introduction

In this page you can find the example usage for org.apache.commons.functor.adapter BinaryFunctionFunction BinaryFunctionFunction.

Prototype

public BinaryFunctionFunction(BinaryFunction<? super A, ? super A, ? extends T> function) 

Source Link

Document

Create a new BinaryFunctionFunction.

Usage

From source file:org.apache.commons.functor.example.kata.four.DataMunger.java

/**
 * A Function that returns the absolute value of the difference
 * between the Integers stored in the <i>col1</i> and <i>col2</i>th
 * whitespace delimited columns of the input line (a String).
 *//*from  w w  w  . j av a  2 s  .  c  o m*/
private static Function<String, Integer> absSpread(final int col1, final int col2) {
    return Composite.function(Abs.instance(),
            new BinaryFunctionFunction<String, Number>(Composite.function(Subtract.instance(),
                    Composite.function(ToInteger.instance(), NthColumn.instance(col1)),
                    Composite.function(ToInteger.instance(), NthColumn.instance(col2)))));
}