Interface TreeModule


  • interface TreeModule
    Because the empty tree Empty cannot be a child of an existing tree, method implementations distinguish between the empty and non-empty case. Because the structure of trees is recursive, often we have commands in the form of module classes with one static method.
    • Method Detail

      • flatMap

        static <T,​U> Tree<U> flatMap​(@NonNull Tree.Node<T> node,
                                           @NonNull java.util.function.Function<? super T,​? extends java.lang.Iterable<? extends U>> mapper)
      • map

        static <T,​U> Tree.Node<U> map​(@NonNull Tree.Node<T> node,
                                            @NonNull java.util.function.Function<? super T,​? extends U> mapper)
      • replace

        static <T> Tree.Node<T> replace​(@NonNull Tree.Node<T> node,
                                        T currentElement,
                                        T newElement)
      • unzip

        static <T,​T1,​T2> Tuple2<Tree.Node<T1>,​Tree.Node<T2>> unzip​(@NonNull Tree.Node<T> node,
                                                                                     @NonNull java.util.function.Function<? super T,​Tuple2<? extends T1,​? extends T2>> unzipper)
      • unzip3

        static <T,​T1,​T2,​T3> Tuple3<Tree.Node<T1>,​Tree.Node<T2>,​Tree.Node<T3>> unzip3​(@NonNull Tree.Node<T> node,
                                                                                                                   @NonNull java.util.function.Function<? super T,​Tuple3<? extends T1,​? extends T2,​? extends T3>> unzipper)
      • zip

        static <T,​U,​R> Tree<R> zip​(@NonNull Tree.Node<T> node,
                                               @NonNull java.util.Iterator<? extends U> that,
                                               java.util.function.BiFunction<? super T,​? super U,​? extends R> mapper)
      • zipAll

        static <T,​U> Tree<Tuple2<T,​U>> zipAll​(@NonNull Tree.Node<T> node,
                                                          @NonNull java.util.Iterator<? extends U> that,
                                                          U thatElem)