Exemplo n.º 1
0
            public Next(RLazy <T> head, RLazy <LazyList <T> > tail)
            {
                Preconditions.checkNotNull(head, "head");
                Preconditions.checkNotNull(tail, "tail");

                this.head_m = head;
                this.tail_m = tail;
            }
Exemplo n.º 2
0
 /**
  * @post Maps in the image of specified function
  */
 public RLazy <LazyList <S> > map <S>(RLazy <LFunction <T, S> > function) => new RLazy <LazyList <S> >(async() =>
 {
     if (this.isEmpty())
     {
         return(new LazyList <S>());
     }
     else
     {
         return(new LazyList <S>((await function.get())(this.head()), (await this.tail().get()).map <S>(function)));
     }
 });
Exemplo n.º 3
0
        /**
         * @post Zip with the specified list and the specified function
         */
        public RLazy <LazyList <U> > zipWith <S, U>(RLazy <LazyList <S> > otherList, RLazy <Func <RLazy <T>, RLazy <S>, RLazy <U> > > function) => new RLazy <LazyList <U> >(async() =>
        {
            LazyList <S> otherList_eager = await otherList.get();

            if (this.isEmpty() || otherList_eager.isEmpty())
            {
                return(new LazyList <U>());
            }
            else
            {
                return(new LazyList <U>((await function.get())(this.head(), otherList_eager.head()), (await this.tail().get()).zipWith <S, U>(otherList_eager.tail(), function)));
            }
        });
Exemplo n.º 4
0
 public LazyList(RLazy <T> head)
 {
     this.next_m = new Optional <Next>(new Next(head, new LazyList <T>()));
 }
Exemplo n.º 5
0
 public LazyList(RLazy <T> head, RLazy <LazyList <T> > tail)
 {
     this.next_m = new Optional <Next>(new Next(head, tail));
 }