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

org.comroid.api.Junction Maven / Gradle / Ivy

The newest version!
package org.comroid.api;

import java.util.function.Function;

public interface Junction {
    static  Junction of(Function pForward, Function pBackward) {
        return new Junction() {
            private final Function forward = pForward;
            private final Function backward = pBackward;

            @Override
            public B forward(A a) {
                return forward.apply(a);
            }

            @Override
            public A backward(B b) {
                return backward.apply(b);
            }
        };
    }

    static  Junction identity() {
        return of(Function.identity(), Function.identity());
    }

    B forward(A a);

    A backward(B b);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy