Package io.vavr

Class API.Match.Pattern2<T,​T1,​T2>

  • Type Parameters:
    T - Class type that is matched by this pattern
    T1 - Member type 1 of the composite part this pattern decomposes
    T2 - Member type 2 of the composite part this pattern decomposes
    All Implemented Interfaces:
    API.Match.Pattern<T,​Tuple2<T1,​T2>>, Function1<T,​Tuple2<T1,​T2>>, PartialFunction<T,​Tuple2<T1,​T2>>, java.io.Serializable, java.util.function.Function<T,​Tuple2<T1,​T2>>
    Enclosing class:
    API.Match<T>

    public abstract static class API.Match.Pattern2<T,​T1,​T2>
    extends java.lang.Object
    implements API.Match.Pattern<T,​Tuple2<T1,​T2>>
    A API.Match.Pattern implementation for the pattern with 2 intermediate types
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        The serial version UID for serialization.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Pattern2

        protected Pattern2()
        Creates a new Pattern2.

        This constructor is protected because Pattern2 is abstract and intended to be subclassed rather than instantiated directly.

    • Method Detail

      • of

        public static <T,​T1 extends U1,​U1,​T2 extends U2,​U2> API.Match.Pattern2<T,​T1,​T2> of​(@NonNull java.lang.Class<? super T> type,
                                                                                                                               @NonNull API.Match.Pattern<T1,​?> p1,
                                                                                                                               @NonNull API.Match.Pattern<T2,​?> p2,
                                                                                                                               @NonNull java.util.function.Function<T,​Tuple2<U1,​U2>> unapply)
        Static factory for a API.Match.Pattern2 based on a Class, 2 API.Match.Patterns to decompose it to and a mapper to aggregate result back into a Tuple2
        Type Parameters:
        T - Class type matched by this pattern
        T1 - Member type 1 of the composite part this pattern decomposes
        U1 - Member type 1 of the Tuple the composite part of this pattern decomposes to
        T2 - Member type 2 of the composite part this pattern decomposes
        U2 - Member type 2 of the Tuple the composite part of this pattern decomposes to
        Parameters:
        type - Class to build the pattern from
        p1 - API.Match.Pattern matching the intermediate type 1
        p2 - API.Match.Pattern matching the intermediate type 2
        unapply - Mapper function from T to a Tuple2
        Returns:
        new Pattern2