@Test public void stream(){ System.out.println("D"+of(1, 2, 3, 4, 5).drop(2).toList()); assertThat(NonEmptyList.of(1,2,3).foldLeft(0,(a,b)->a+b),equalTo(6)); NonEmptyList.of(1,2,3,4).takeRight(2).forEach(System.out::println); }
public ReactiveSeq<T> stream(){ return ReactiveSeq.fromIterable(this); }
NonEmptyList implements Deconstruct2<T,ImmutableList<T>>,
                                        ImmutableList<T>,
                                        ImmutableList.Some<T>,
                                        Higher<nonEmptyList,T> { public ReactiveSeq<T> stream(){ return ReactiveSeq.fromIterable(this); } }
NonEmptyList implements Deconstruct2<T,ImmutableList<T>>,
                                        ImmutableList<T>,
                                        ImmutableList.Some<T>,
                                        Higher<nonEmptyList,T> { public ReactiveSeq<T> stream(){ return ReactiveSeq.fromIterable(this); }  }
NonEmptyList implements Deconstruct2<T,ImmutableList<T>>,
                                        ImmutableList<T>,
                                        ImmutableList.Some<T>,
                                        Higher<nonEmptyList,T> { public ReactiveSeq<T> stream(){ return ReactiveSeq.fromIterable(this); }  @Override ImmutableList<R> unitIterable(Iterable<R> it); ReactiveSeq<T> stream(); LazySeq<T> linkedSeq(); static NonEmptyList<T> of(T head, T... value); static NonEmptyList<T> of(T head); static NonEmptyList<T> eager(T head, T... value); static NonEmptyList<T> eager(T head); static NonEmptyList<T> of(T head, ImmutableList<T> list); Option<T> get(int pos); @Override T getOrElse(int pos, T alt); @Override T getOrElseGet(int pos, Supplier<? extends T> alt); LazySeq<T> lazySeq(); @Override ImmutableList<R> unitStream(Stream<R> stream); @Override ImmutableList<T> emptyUnit(); @Override ImmutableList<T> drop(long num); @Override ImmutableList<T> take(long num); NonEmptyList<T> prepend(T value); @Override NonEmptyList<T> replaceFirst(T currentElement, T newElement); @Override NonEmptyList<T> insertAt(int pos, T... values); @Override NonEmptyList<T> plusAll(Iterable<? extends T> list); @Override NonEmptyList<T> plus(T value); @Override NonEmptyList<T> updateAt(int pos, T value); @Override NonEmptyList<T> insertAt(int pos, Iterable<? extends T> values); @Override NonEmptyList<T> insertAt(int i, T value); @Override NonEmptyList<T> prependAll(Iterable<? extends T> value); @Override NonEmptyList<T> append(T value); @Override NonEmptyList<T> appendAll(Iterable<? extends T> value); @Override ImmutableList<T> tail(); @Override T head(); @Override NonEmptyList<T> reverse(); NonEmptyList<T> prependAll(NonEmptyList<T> value); ImmutableList<T> filter(Predicate<? super T> pred); NonEmptyList<R> map(Function<? super T, ? extends R> fn); @Override NonEmptyList<T> peek(Consumer<? super T> c); @Override R fold(Function<? super Some<T>, ? extends R> fn1, Function<? super None<T>, ? extends R> fn2); @Override NonEmptyList<T> onEmpty(T value); @Override NonEmptyList<T> onEmptyGet(Supplier<? extends T> supplier); @Override NonEmptyList<T> onEmptySwitch(Supplier<? extends ImmutableList<T>> supplier); @Override ImmutableList<R> flatMap(Function<? super T, ? extends ImmutableList<? extends R>> fn); @Override ImmutableList<R> concatMap(Function<? super T, ? extends Iterable<? extends R>> fn); @Override ImmutableList<R> mergeMap(Function<? super T, ? extends Publisher<? extends R>> fn); @Override ImmutableList<R> mergeMap(int maxConcurecy, Function<? super T, ? extends Publisher<? extends R>> fn); NonEmptyList<R> flatMapNel(Function<? super T, ? extends NonEmptyList<R>> fn); R foldRight(R zero,BiFunction<? super T, ? super R, ? extends R> f); T reduce(BiFunction<? super T, ? super T, ? extends T> f); R foldLeft(R zero,BiFunction<R, ? super T, R> f); int size(); @Override boolean isEmpty(); static NonEmptyList<T> cons(T value, ImmutableList<T> tail); @Override String toString(); @Override Tuple2<T, ImmutableList<T>> unapply(); @Override boolean equals(Object o); @Override int hashCode(); @Override NonEmptyList<ReactiveSeq<T>> permutations(); @Override NonEmptyList<ReactiveSeq<T>> combinations(int size); @Override NonEmptyList<ReactiveSeq<T>> combinations(); @Override NonEmptyList<Tuple2<T, Long>> zipWithIndex(); @Override NonEmptyList<Seq<T>> sliding(int windowSize); @Override NonEmptyList<Seq<T>> sliding(int windowSize, int increment); @Override NonEmptyList<C> grouped(int size, Supplier<C> supplier); @Override NonEmptyList<Vector<T>> groupedUntil(Predicate<? super T> predicate); @Override NonEmptyList<Vector<T>> groupedUntil(BiPredicate<Vector<? super T>, ? super T> predicate); @Override NonEmptyList<Vector<T>> groupedWhile(Predicate<? super T> predicate); @Override NonEmptyList<C> groupedWhile(Predicate<? super T> predicate, Supplier<C> factory); @Override NonEmptyList<C> groupedUntil(Predicate<? super T> predicate, Supplier<C> factory); @Override NonEmptyList<Vector<T>> grouped(int groupSize); @Override NonEmptyList<T> distinct(); @Override NonEmptyList<T> scanLeft(Monoid<T> monoid); @Override NonEmptyList<U> scanLeft(U seed, BiFunction<? super U, ? super T, ? extends U> function); @Override NonEmptyList<T> scanRight(Monoid<T> monoid); @Override NonEmptyList<U> scanRight(U identity, BiFunction<? super T, ? super U, ? extends U> combiner); @Override NonEmptyList<T> sorted(); @Override NonEmptyList<T> sorted(Comparator<? super T> c); @Override NonEmptyList<T> intersperse(T value); @Override NonEmptyList<T> shuffle(); @Override NonEmptyList<T> shuffle(Random random); @Override Iterator<T> iterator(); @Override NonEmptyList<T> prependStream(Stream<? extends T> stream); @Override NonEmptyList<T> appendAll(T... values); @Override NonEmptyList<T> prependAll(T... values); @Override NonEmptyList<T> insertStreamAt(int pos, Stream<T> stream); @Override NonEmptyList<T> sorted(Function<? super T, ? extends U> function); }
NonEmptyList implements Deconstruct2<T,ImmutableList<T>>,
                                        ImmutableList<T>,
                                        ImmutableList.Some<T>,
                                        Higher<nonEmptyList,T> { public ReactiveSeq<T> stream(){ return ReactiveSeq.fromIterable(this); }  @Override ImmutableList<R> unitIterable(Iterable<R> it); ReactiveSeq<T> stream(); LazySeq<T> linkedSeq(); static NonEmptyList<T> of(T head, T... value); static NonEmptyList<T> of(T head); static NonEmptyList<T> eager(T head, T... value); static NonEmptyList<T> eager(T head); static NonEmptyList<T> of(T head, ImmutableList<T> list); Option<T> get(int pos); @Override T getOrElse(int pos, T alt); @Override T getOrElseGet(int pos, Supplier<? extends T> alt); LazySeq<T> lazySeq(); @Override ImmutableList<R> unitStream(Stream<R> stream); @Override ImmutableList<T> emptyUnit(); @Override ImmutableList<T> drop(long num); @Override ImmutableList<T> take(long num); NonEmptyList<T> prepend(T value); @Override NonEmptyList<T> replaceFirst(T currentElement, T newElement); @Override NonEmptyList<T> insertAt(int pos, T... values); @Override NonEmptyList<T> plusAll(Iterable<? extends T> list); @Override NonEmptyList<T> plus(T value); @Override NonEmptyList<T> updateAt(int pos, T value); @Override NonEmptyList<T> insertAt(int pos, Iterable<? extends T> values); @Override NonEmptyList<T> insertAt(int i, T value); @Override NonEmptyList<T> prependAll(Iterable<? extends T> value); @Override NonEmptyList<T> append(T value); @Override NonEmptyList<T> appendAll(Iterable<? extends T> value); @Override ImmutableList<T> tail(); @Override T head(); @Override NonEmptyList<T> reverse(); NonEmptyList<T> prependAll(NonEmptyList<T> value); ImmutableList<T> filter(Predicate<? super T> pred); NonEmptyList<R> map(Function<? super T, ? extends R> fn); @Override NonEmptyList<T> peek(Consumer<? super T> c); @Override R fold(Function<? super Some<T>, ? extends R> fn1, Function<? super None<T>, ? extends R> fn2); @Override NonEmptyList<T> onEmpty(T value); @Override NonEmptyList<T> onEmptyGet(Supplier<? extends T> supplier); @Override NonEmptyList<T> onEmptySwitch(Supplier<? extends ImmutableList<T>> supplier); @Override ImmutableList<R> flatMap(Function<? super T, ? extends ImmutableList<? extends R>> fn); @Override ImmutableList<R> concatMap(Function<? super T, ? extends Iterable<? extends R>> fn); @Override ImmutableList<R> mergeMap(Function<? super T, ? extends Publisher<? extends R>> fn); @Override ImmutableList<R> mergeMap(int maxConcurecy, Function<? super T, ? extends Publisher<? extends R>> fn); NonEmptyList<R> flatMapNel(Function<? super T, ? extends NonEmptyList<R>> fn); R foldRight(R zero,BiFunction<? super T, ? super R, ? extends R> f); T reduce(BiFunction<? super T, ? super T, ? extends T> f); R foldLeft(R zero,BiFunction<R, ? super T, R> f); int size(); @Override boolean isEmpty(); static NonEmptyList<T> cons(T value, ImmutableList<T> tail); @Override String toString(); @Override Tuple2<T, ImmutableList<T>> unapply(); @Override boolean equals(Object o); @Override int hashCode(); @Override NonEmptyList<ReactiveSeq<T>> permutations(); @Override NonEmptyList<ReactiveSeq<T>> combinations(int size); @Override NonEmptyList<ReactiveSeq<T>> combinations(); @Override NonEmptyList<Tuple2<T, Long>> zipWithIndex(); @Override NonEmptyList<Seq<T>> sliding(int windowSize); @Override NonEmptyList<Seq<T>> sliding(int windowSize, int increment); @Override NonEmptyList<C> grouped(int size, Supplier<C> supplier); @Override NonEmptyList<Vector<T>> groupedUntil(Predicate<? super T> predicate); @Override NonEmptyList<Vector<T>> groupedUntil(BiPredicate<Vector<? super T>, ? super T> predicate); @Override NonEmptyList<Vector<T>> groupedWhile(Predicate<? super T> predicate); @Override NonEmptyList<C> groupedWhile(Predicate<? super T> predicate, Supplier<C> factory); @Override NonEmptyList<C> groupedUntil(Predicate<? super T> predicate, Supplier<C> factory); @Override NonEmptyList<Vector<T>> grouped(int groupSize); @Override NonEmptyList<T> distinct(); @Override NonEmptyList<T> scanLeft(Monoid<T> monoid); @Override NonEmptyList<U> scanLeft(U seed, BiFunction<? super U, ? super T, ? extends U> function); @Override NonEmptyList<T> scanRight(Monoid<T> monoid); @Override NonEmptyList<U> scanRight(U identity, BiFunction<? super T, ? super U, ? extends U> combiner); @Override NonEmptyList<T> sorted(); @Override NonEmptyList<T> sorted(Comparator<? super T> c); @Override NonEmptyList<T> intersperse(T value); @Override NonEmptyList<T> shuffle(); @Override NonEmptyList<T> shuffle(Random random); @Override Iterator<T> iterator(); @Override NonEmptyList<T> prependStream(Stream<? extends T> stream); @Override NonEmptyList<T> appendAll(T... values); @Override NonEmptyList<T> prependAll(T... values); @Override NonEmptyList<T> insertStreamAt(int pos, Stream<T> stream); @Override NonEmptyList<T> sorted(Function<? super T, ? extends U> function);  }