All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jedi.functors.ComposeableFunctor0 Maven / Gradle / Ivy

The newest version!
package jedi.functors;

import jedi.functional.Functor;
import jedi.functional.Functor0;

public class ComposeableFunctor0 implements Functor0 {

    private final Functor0 functor;

    public ComposeableFunctor0(final Functor0 functor) {
        this.functor = functor;
    }

    /**
     * Function composition: this.andThen(g) == g(this.execute())
     */
    public  ComposeableFunctor0 andThen(final Functor g) {
        return new ComposeableFunctor0(new Functor0() {
            public NEW_R execute() {
                return g.execute(functor.execute());
            }
        });
    }

    public R execute() {
        return functor.execute();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy