Package fj

Interface F2<A,​B,​C>

  • All Superinterfaces:
    java.util.function.BiFunction<A,​B,​C>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface F2<A,​B,​C>
    extends java.util.function.BiFunction<A,​B,​C>
    A transformation function of arity-2 from A and B to C.
    • Method Detail

      • f

        C f​(A a,
            B b)
        Transform A and B to C.
        Parameters:
        a - The A to transform.
        b - The B to transform.
        Returns:
        The result of the transformation.
      • apply

        default C apply​(A a,
                        B b)
        Specified by:
        apply in interface java.util.function.BiFunction<A,​B,​C>
      • f

        default F<B,​C> f​(A a)
        Partial application.
        Parameters:
        a - The A to which to apply this function.
        Returns:
        The function partially applied to the given argument.
      • curry

        default F<A,​F<B,​C>> curry()
        Curries this wrapped function to a wrapped function of arity-1 that returns another wrapped function.
        Returns:
        a wrapped function of arity-1 that returns another wrapped function.
      • flip

        default F2<B,​A,​C> flip()
        Flips the arguments of this function.
        Returns:
        A new function with the arguments of this function flipped.
      • tuple

        default F<P2<A,​B>,​C> tuple()
        Uncurries this function to a function on tuples.
        Returns:
        A new function that calls this function with the elements of a given tuple.
      • arrayM

        default F2<Array<A>,​Array<B>,​Array<C>> arrayM()
        Promotes this function to a function on Arrays.
        Returns:
        This function promoted to transform Arrays.
      • promiseM

        default F2<Promise<A>,​Promise<B>,​Promise<C>> promiseM()
        Promotes this function to a function on Promises.
        Returns:
        This function promoted to transform Promises.
      • iterableM

        default F2<java.lang.Iterable<A>,​java.lang.Iterable<B>,​IterableW<C>> iterableM()
        Promotes this function to a function on Iterables.
        Returns:
        This function promoted to transform Iterables.
      • listM

        default F2<List<A>,​List<B>,​List<C>> listM()
        Promotes this function to a function on Lists.
        Returns:
        This function promoted to transform Lists.
      • optionM

        default F2<Option<A>,​Option<B>,​Option<C>> optionM()
        Promotes this function to a function on Options.
        Returns:
        This function promoted to transform Options.
      • setM

        default F2<Set<A>,​Set<B>,​Set<C>> setM​(Ord<C> o)
        Promotes this function to a function on Sets.
        Parameters:
        o - An ordering for the result of the promoted function.
        Returns:
        This function promoted to transform Sets.
      • streamM

        default F2<Stream<A>,​Stream<B>,​Stream<C>> streamM()
        Promotes this function to a function on Streams.
        Returns:
        This function promoted to transform Streams.
      • treeM

        default F2<Tree<A>,​Tree<B>,​Tree<C>> treeM()
        Promotes this function to a function on Trees.
        Returns:
        This function promoted to transform Trees.
      • zipArrayM

        default F2<Array<A>,​Array<B>,​Array<C>> zipArrayM()
        Promotes this function to zip two arrays, applying the function lock-step over both Arrays.
        Returns:
        A function that zips two arrays with this function.
      • zipIterableM

        default F2<java.lang.Iterable<A>,​java.lang.Iterable<B>,​java.lang.Iterable<C>> zipIterableM()
        Promotes this function to zip two iterables, applying the function lock-step over both iterables.
        Returns:
        A function that zips two iterables with this function.
      • zipListM

        default F2<List<A>,​List<B>,​List<C>> zipListM()
        Promotes this function to zip two lists, applying the function lock-step over both lists.
        Returns:
        A function that zips two lists with this function.
      • zipStreamM

        default F2<Stream<A>,​Stream<B>,​Stream<C>> zipStreamM()
        Promotes this function to zip two streams, applying the function lock-step over both streams.
        Returns:
        A function that zips two streams with this function.
      • zipNelM

        default F2<NonEmptyList<A>,​NonEmptyList<B>,​NonEmptyList<C>> zipNelM()
        Promotes this function to zip two non-empty lists, applying the function lock-step over both lists.
        Returns:
        A function that zips two non-empty lists with this function.
      • zipSetM

        default F2<Set<A>,​Set<B>,​Set<C>> zipSetM​(Ord<C> o)
        Promotes this function to zip two sets, applying the function lock-step over both sets.
        Parameters:
        o - An ordering for the resulting set.
        Returns:
        A function that zips two sets with this function.
      • zipTreeM

        default F2<Tree<A>,​Tree<B>,​Tree<C>> zipTreeM()
        Promotes this function to zip two trees, applying the function lock-step over both trees. The structure of the resulting tree is the structural intersection of the two trees.
        Returns:
        A function that zips two trees with this function.
      • zipZipperM

        default F2<Zipper<A>,​Zipper<B>,​Zipper<C>> zipZipperM()
        Promotes this function to zip two zippers, applying the function lock-step over both zippers in both directions. The structure of the resulting zipper is the structural intersection of the two zippers.
        Returns:
        A function that zips two zippers with this function.
      • zipTreeZipperM

        default F2<TreeZipper<A>,​TreeZipper<B>,​TreeZipper<C>> zipTreeZipperM()
        Promotes this function to zip two TreeZippers, applying the function lock-step over both zippers in all directions. The structure of the resulting TreeZipper is the structural intersection of the two TreeZippers.
        Returns:
        A function that zips two TreeZippers with this function.
      • contramapFirst

        default <Z> F2<Z,​B,​C> contramapFirst​(F<Z,​A> f)
      • contramapSecond

        default <Z> F2<A,​Z,​C> contramapSecond​(F<Z,​B> f)
      • contramap

        default <X,​Y> F2<X,​Y,​C> contramap​(F<X,​A> f,
                                                            F<Y,​B> g)
      • map

        default <Z> F2<A,​B,​Z> map​(F<C,​Z> f)