me.shaftesbury.utils.functional.BinaryFunction Maven / Gradle / Ivy
package me.shaftesbury.utils.functional;
/**
* Created with IntelliJ IDEA.
* User: Bob
* Date: 01/12/13
* Time: 23:36
* To change this template use File | Settings | File Templates.
*/
public abstract class BinaryFunction implements Func2
{
public Func> toFunc()
{
return toUnaryFunc(this);
}
public Func toFunc(B b)
{
return toUnaryFunc(this).apply(b);
}
private static final Func> toUnaryFunc(final BinaryFunction f)
{
return new Func>()
{
@Override
public Func apply(final B b) {
return new Func() {
@Override
public C apply(final A a) {
return f.apply(a,b);
}
};
}
};
}
public static final Func0 delay(final Func2 f, final A a, final B b)
{
return new Func0() {
@Override
public C apply() {
return f.apply(a,b);
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy