fj.function.Longs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionaljava Show documentation
Show all versions of functionaljava Show documentation
Functional Java is an open source library that supports closures for the Java programming language
package fj.function;
import fj.F;
import static fj.Function.curry;
import static fj.Semigroup.longAdditionSemigroup;
import static fj.Semigroup.longMultiplicationSemigroup;
import static java.lang.Math.abs;
/**
* Curried functions over Longs.
*
* @version %build.number%
*/
public final class Longs {
private Longs() {
throw new UnsupportedOperationException();
}
/**
* Curried Long addition.
*/
public static final F> add = longAdditionSemigroup.sum();
/**
* Curried Long multiplication.
*/
public static final F> multiply = longMultiplicationSemigroup.sum();
/**
* Curried Long subtraction.
*/
public static final F> subtract = curry((x, y) -> x - y);
/**
* Negation.
*/
public static final F negate = x -> x * -1L;
/**
* Absolute value.
*/
public static final F abs = Math::abs;
/**
* Remainder.
*/
public static final F> remainder = curry((a, b) -> a % b);
}