me.shaftesbury.utils.functional.UnaryFunction 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 UnaryFunction implements Func
{
public UnaryFunction then(final Func f)
{
return compose(this,f);
}
private static final UnaryFunction compose(final Func f, final Func g)
{
return new UnaryFunction()
{
public C apply(final A a) { return g.apply(f.apply(a));}
};
}
public static final Func0 delay(final Func f, final A a)
{
return new Func0()
{
@Override
public B apply() {
return f.apply(a);
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy