Class LL<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>
    Direct Known Subclasses:
    LL.Cons, LL.Nil

    public abstract class LL<T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    Immutable singly-linked list.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LL.Cons<T>  
      private static class  LL.Nil<T>  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private LL()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean all​(java.util.function.Predicate<T> cond)  
      static <T> LL<? extends T> concat​(LL<? extends T> l1, LL<? extends T> l2)  
      static <T> LL.Cons<T> cons​(T head, LL<? extends T> tail)  
      abstract <R> R fold​(R acc, java.util.function.BiFunction<? super R,​? super T,​? extends R> reduction)  
      abstract T head()  
      abstract boolean isEmpty()  
      abstract <U> LL<U> map​(java.util.function.Function<? super T,​? extends U> f)  
      <U> U mapFirst2​(java.util.function.BiFunction<? super T,​? super T,​? extends U> f)  
      <U> U mapFirst3​(TriFunction<? super T,​? super T,​? super T,​? extends U> f)  
      <U> U mapFirst4​(TetraFunction<? super T,​? super T,​? super T,​? super T,​? extends U> f)  
      <U> U mapFirst5​(PentaFunction<? super T,​? super T,​? super T,​? super T,​? super T,​? extends U> f)  
      <U> U mapFirst6​(HexaFunction<? super T,​? super T,​? super T,​? super T,​? super T,​? super T,​? extends U> f)  
      abstract <R> java.util.Optional<R> mapReduce​(java.util.function.Function<? super T,​? extends R> map, java.util.function.BinaryOperator<R> reduce)  
      static <T> LL<T> nil()  
      private static <T> LL<T> of​(T[] elems, int to, LL<T> tail)  
      static <T> LL.Cons<T> of​(T head, T... tail)  
      abstract int size()  
      java.util.stream.Stream<T> stream()  
      abstract LL<? extends T> tail()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Constructor Detail

      • LL

        private LL()
    • Method Detail

      • nil

        public static <T> LL<T> nil()
      • cons

        public static <T> LL.Cons<T> cons​(T head,
                                          LL<? extends T> tail)
      • of

        @SafeVarargs
        public static <T> LL.Cons<T> of​(T head,
                                        T... tail)
      • of

        private static <T> LL<T> of​(T[] elems,
                                    int to,
                                    LL<T> tail)
      • concat

        public static <T> LL<? extends T> concat​(LL<? extends T> l1,
                                                 LL<? extends T> l2)
      • isEmpty

        public abstract boolean isEmpty()
      • size

        public abstract int size()
      • head

        public abstract T head()
      • tail

        public abstract LL<? extends T> tail()
      • map

        public abstract <U> LL<U> map​(java.util.function.Function<? super T,​? extends U> f)
      • fold

        public abstract <R> R fold​(R acc,
                                   java.util.function.BiFunction<? super R,​? super T,​? extends R> reduction)
      • mapReduce

        public abstract <R> java.util.Optional<R> mapReduce​(java.util.function.Function<? super T,​? extends R> map,
                                                            java.util.function.BinaryOperator<R> reduce)
      • all

        public boolean all​(java.util.function.Predicate<T> cond)
      • mapFirst2

        public <U> U mapFirst2​(java.util.function.BiFunction<? super T,​? super T,​? extends U> f)
      • mapFirst3

        public <U> U mapFirst3​(TriFunction<? super T,​? super T,​? super T,​? extends U> f)
      • mapFirst4

        public <U> U mapFirst4​(TetraFunction<? super T,​? super T,​? super T,​? super T,​? extends U> f)
      • mapFirst5

        public <U> U mapFirst5​(PentaFunction<? super T,​? super T,​? super T,​? super T,​? super T,​? extends U> f)
      • mapFirst6

        public <U> U mapFirst6​(HexaFunction<? super T,​? super T,​? super T,​? super T,​? super T,​? super T,​? extends U> f)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • stream

        public java.util.stream.Stream<T> stream()