@Test public void peek() { result = null; VectorT<Witness.optional,Integer> streamT = VectorT.ofList(AnyM.fromOptional(Optional.of(Vector.of(10)))); streamT.peek(num->result = "hello world"+num) .unwrap().<Optional<Vector<String>>>unwrap().get().get(0); assertThat(result, equalTo("hello world10")); }
@Override public VectorT<W,T> peek(final Consumer<? super T> peek) { return map(a -> { peek.accept(a); return a; }); }
VectorT implements To<VectorT<W,T>>,
                                                          FoldableTransformerSeq<W,T> { @Override public VectorT<W,T> peek(final Consumer<? super T> peek) { return map(a -> { peek.accept(a); return a; }); } }
VectorT implements To<VectorT<W,T>>,
                                                          FoldableTransformerSeq<W,T> { @Override public VectorT<W,T> peek(final Consumer<? super T> peek) { return map(a -> { peek.accept(a); return a; }); } private  VectorT(final AnyM<W,? extends Vector<T>> run); }
VectorT implements To<VectorT<W,T>>,
                                                          FoldableTransformerSeq<W,T> { @Override public VectorT<W,T> peek(final Consumer<? super T> peek) { return map(a -> { peek.accept(a); return a; }); } private  VectorT(final AnyM<W,? extends Vector<T>> run); AnyM<W,Vector<T>> unwrap(); R unwrapTo(Function<? super AnyM<W,Vector<T>>,? extends R> fn); @Override VectorT<W,T> peek(final Consumer<? super T> peek); @Override VectorT<W,T> filter(final Predicate<? super T> test); @Override VectorT<W,B> map(final Function<? super T, ? extends B> f); @Override VectorT<W,B> flatMap(final Function<? super T, ? extends Iterable<? extends B>> f); VectorT<W,B> flatMapT(final Function<? super T, VectorT<W,B>> f); static VectorT<W,A> fromAnyM(final AnyM<W,A> anyM); static VectorT<W,A> of(final AnyM<W,? extends Vector<A>> monads); static VectorT<W,A> ofList(final AnyM<W,? extends PersistentList<A>> monads); static VectorT<Witness.stream,A> fromStream(final Stream<? extends Vector<A>> nested); static VectorT<Witness.reactiveSeq,A> fromStream(final ReactiveSeq<? extends Vector<A>> nested); static VectorT<Witness.optional,A> fromOptional(final Optional<? extends Vector<A>> nested); static VectorT<Witness.maybe,A> fromMaybe(final Maybe<? extends Vector<A>> nested); static VectorT<list,A> fromList(final List<? extends Vector<A>> nested); static VectorT<Witness.set,A> fromSet(final Set<? extends Vector<A>> nested); @Override String toString(); VectorT<W,T> unit(final T unit); @Override ReactiveSeq<T> stream(); @Override Iterator<T> iterator(); @Override VectorT<W,R> unitIterable(final Iterable<R> it); @Override VectorT<W,R> empty(); @Override AnyM<W,? extends IterableX<T>> nestedFoldables(); @Override AnyM<W,? extends IterableX<T>> nestedCollectables(); @Override VectorT<W,T> unitAnyM(final AnyM<W,Traversable<T>> traversable); @Override AnyM<W,? extends IterableX<T>> transformerStream(); static VectorT<W,T> emptyList(W witness); @Override boolean isSeqPresent(); @Override VectorT<W,T> combine(final BiPredicate<? super T, ? super T> predicate, final BinaryOperator<T> op); @Override VectorT<W,T> combine(final Monoid<T> op, final BiPredicate<? super T, ? super T> predicate); @Override VectorT<W,T> cycle(final long times); @Override VectorT<W,T> cycle(final Monoid<T> m, final long times); @Override VectorT<W,T> cycleWhile(final Predicate<? super T> predicate); @Override VectorT<W,T> cycleUntil(final Predicate<? super T> predicate); @Override VectorT<W,R> zip(final Iterable<? extends U> other, final BiFunction<? super T, ? super U, ? extends R> zipper); @Override VectorT<W,R> zipWithStream(final Stream<? extends U> other, final BiFunction<? super T, ? super U, ? extends R> zipper); @Override VectorT<W,Tuple2<T, U>> zipWithStream(final Stream<? extends U> other); @Override VectorT<W,Tuple2<T, U>> zip(final Iterable<? extends U> other); @Override VectorT<W,Tuple3<T, S, U>> zip3(final Iterable<? extends S> second, final Iterable<? extends U> third); @Override VectorT<W,Tuple4<T, T2, T3, T4>> zip4(final Iterable<? extends T2> second, final Iterable<? extends T3> third,
                                                              final Iterable<? extends T4> fourth); @Override VectorT<W,Tuple2<T, Long>> zipWithIndex(); @Override VectorT<W,Seq<T>> sliding(final int windowSize); @Override VectorT<W,Seq<T>> sliding(final int windowSize, final int increment); @Override VectorT<W,C> grouped(final int size, final Supplier<C> supplier); @Override VectorT<W,Vector<T>> groupedUntil(final Predicate<? super T> predicate); @Override VectorT<W,Vector<T>> groupedUntil(final BiPredicate<Vector<? super T>, ? super T> predicate); @Override VectorT<W,Vector<T>> groupedWhile(final Predicate<? super T> predicate); @Override VectorT<W,C> groupedWhile(final Predicate<? super T> predicate, final Supplier<C> factory); @Override VectorT<W,C> groupedUntil(final Predicate<? super T> predicate, final Supplier<C> factory); @Override VectorT<W,Vector<T>> grouped(final int groupSize); @Override VectorT<W,T> distinct(); @Override VectorT<W,T> scanLeft(final Monoid<T> monoid); @Override VectorT<W,U> scanLeft(final U seed, final BiFunction<? super U, ? super T, ? extends U> function); @Override VectorT<W,T> scanRight(final Monoid<T> monoid); @Override VectorT<W,U> scanRight(final U identity, final BiFunction<? super T, ? super U, ? extends U> combiner); @Override VectorT<W,T> sorted(); @Override VectorT<W,T> sorted(final Comparator<? super T> c); @Override VectorT<W,T> takeWhile(final Predicate<? super T> p); @Override VectorT<W,T> dropWhile(final Predicate<? super T> p); @Override VectorT<W,T> takeUntil(final Predicate<? super T> p); @Override VectorT<W,T> dropUntil(final Predicate<? super T> p); @Override VectorT<W,T> dropRight(final int num); @Override VectorT<W,T> takeRight(final int num); @Override VectorT<W,T> intersperse(final T value); @Override VectorT<W,T> reverse(); @Override VectorT<W,T> shuffle(); @Override VectorT<W,T> onEmpty(final T value); @Override VectorT<W,T> onEmptyGet(final Supplier<? extends T> supplier); @Override VectorT<W,T> shuffle(final Random random); @Override VectorT<W,T> slice(final long from, final long to); @Override VectorT<W,T> sorted(final Function<? super T, ? extends U> function); @Override int hashCode(); @Override boolean equals(final Object o); VectorT<W,R> forEach4M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                      BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                      Function3<? super T, ? super R1, ? super R2, ? extends VectorT<W,R3>> value3,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, ? extends R> yieldingFunction); VectorT<W,R> forEach4M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                      BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                      Function3<? super T, ? super R1, ? super R2, ? extends VectorT<W,R3>> value3,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, Boolean> filterFunction,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, ? extends R> yieldingFunction); VectorT<W,R> forEach3M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                  BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                  Function3<? super T, ? super R1, ? super R2, ? extends R> yieldingFunction); VectorT<W,R> forEach3M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                  BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                  Function3<? super T, ? super R1, ? super R2, Boolean> filterFunction,
                                                  Function3<? super T, ? super R1, ? super R2, ? extends R> yieldingFunction); VectorT<W,R> forEach2M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                          BiFunction<? super T, ? super R1, ? extends R> yieldingFunction); VectorT<W,R> forEach2M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                          BiFunction<? super T, ? super R1, Boolean> filterFunction,
                                          BiFunction<? super T, ? super R1, ? extends R> yieldingFunction); @Override VectorT<W,T> prependStream(Stream<? extends T> stream); @Override VectorT<W,T> appendAll(T... values); @Override VectorT<W,T> append(T value); @Override VectorT<W,T> prepend(T value); @Override VectorT<W,T> prependAll(T... values); @Override VectorT<W,T> insertAt(int pos, T... values); @Override VectorT<W,T> deleteBetween(int start, int end); @Override VectorT<W,T> insertStreamAt(int pos, Stream<T> stream); @Override VectorT<W,R> zip(BiFunction<? super T, ? super T2, ? extends R> fn, Publisher<? extends T2> publisher); @Override VectorT<W,Tuple2<T, U>> zipWithPublisher(Publisher<? extends U> other); @Override VectorT<W,R> zip3(Iterable<? extends S> second, Iterable<? extends U> third, Function3<? super T, ? super S, ? super U, ? extends R> fn3); @Override VectorT<W,R> zip4(Iterable<? extends T2> second, Iterable<? extends T3> third, Iterable<? extends T4> fourth, Function4<? super T, ? super T2, ? super T3, ? super T4, ? extends R> fn); @Override VectorT<W,T> removeStream(final Stream<? extends T> stream); @Override VectorT<W,U> ofType(final Class<? extends U> type); @Override VectorT<W,T> removeAll(final Iterable<? extends T> it); @Override VectorT<W,T> removeAll(final T... values); @Override VectorT<W,T> filterNot(final Predicate<? super T> predicate); @Override VectorT<W,T> retainAll(final Iterable<? extends T> it); @Override VectorT<W,T> notNull(); @Override VectorT<W,T> retainStream(final Stream<? extends T> stream); @Override VectorT<W,T> retainAll(final T... values); @Override VectorT<W,T> drop(final long num); @Override VectorT<W,T> take(final long num); }
VectorT implements To<VectorT<W,T>>,
                                                          FoldableTransformerSeq<W,T> { @Override public VectorT<W,T> peek(final Consumer<? super T> peek) { return map(a -> { peek.accept(a); return a; }); } private  VectorT(final AnyM<W,? extends Vector<T>> run); AnyM<W,Vector<T>> unwrap(); R unwrapTo(Function<? super AnyM<W,Vector<T>>,? extends R> fn); @Override VectorT<W,T> peek(final Consumer<? super T> peek); @Override VectorT<W,T> filter(final Predicate<? super T> test); @Override VectorT<W,B> map(final Function<? super T, ? extends B> f); @Override VectorT<W,B> flatMap(final Function<? super T, ? extends Iterable<? extends B>> f); VectorT<W,B> flatMapT(final Function<? super T, VectorT<W,B>> f); static VectorT<W,A> fromAnyM(final AnyM<W,A> anyM); static VectorT<W,A> of(final AnyM<W,? extends Vector<A>> monads); static VectorT<W,A> ofList(final AnyM<W,? extends PersistentList<A>> monads); static VectorT<Witness.stream,A> fromStream(final Stream<? extends Vector<A>> nested); static VectorT<Witness.reactiveSeq,A> fromStream(final ReactiveSeq<? extends Vector<A>> nested); static VectorT<Witness.optional,A> fromOptional(final Optional<? extends Vector<A>> nested); static VectorT<Witness.maybe,A> fromMaybe(final Maybe<? extends Vector<A>> nested); static VectorT<list,A> fromList(final List<? extends Vector<A>> nested); static VectorT<Witness.set,A> fromSet(final Set<? extends Vector<A>> nested); @Override String toString(); VectorT<W,T> unit(final T unit); @Override ReactiveSeq<T> stream(); @Override Iterator<T> iterator(); @Override VectorT<W,R> unitIterable(final Iterable<R> it); @Override VectorT<W,R> empty(); @Override AnyM<W,? extends IterableX<T>> nestedFoldables(); @Override AnyM<W,? extends IterableX<T>> nestedCollectables(); @Override VectorT<W,T> unitAnyM(final AnyM<W,Traversable<T>> traversable); @Override AnyM<W,? extends IterableX<T>> transformerStream(); static VectorT<W,T> emptyList(W witness); @Override boolean isSeqPresent(); @Override VectorT<W,T> combine(final BiPredicate<? super T, ? super T> predicate, final BinaryOperator<T> op); @Override VectorT<W,T> combine(final Monoid<T> op, final BiPredicate<? super T, ? super T> predicate); @Override VectorT<W,T> cycle(final long times); @Override VectorT<W,T> cycle(final Monoid<T> m, final long times); @Override VectorT<W,T> cycleWhile(final Predicate<? super T> predicate); @Override VectorT<W,T> cycleUntil(final Predicate<? super T> predicate); @Override VectorT<W,R> zip(final Iterable<? extends U> other, final BiFunction<? super T, ? super U, ? extends R> zipper); @Override VectorT<W,R> zipWithStream(final Stream<? extends U> other, final BiFunction<? super T, ? super U, ? extends R> zipper); @Override VectorT<W,Tuple2<T, U>> zipWithStream(final Stream<? extends U> other); @Override VectorT<W,Tuple2<T, U>> zip(final Iterable<? extends U> other); @Override VectorT<W,Tuple3<T, S, U>> zip3(final Iterable<? extends S> second, final Iterable<? extends U> third); @Override VectorT<W,Tuple4<T, T2, T3, T4>> zip4(final Iterable<? extends T2> second, final Iterable<? extends T3> third,
                                                              final Iterable<? extends T4> fourth); @Override VectorT<W,Tuple2<T, Long>> zipWithIndex(); @Override VectorT<W,Seq<T>> sliding(final int windowSize); @Override VectorT<W,Seq<T>> sliding(final int windowSize, final int increment); @Override VectorT<W,C> grouped(final int size, final Supplier<C> supplier); @Override VectorT<W,Vector<T>> groupedUntil(final Predicate<? super T> predicate); @Override VectorT<W,Vector<T>> groupedUntil(final BiPredicate<Vector<? super T>, ? super T> predicate); @Override VectorT<W,Vector<T>> groupedWhile(final Predicate<? super T> predicate); @Override VectorT<W,C> groupedWhile(final Predicate<? super T> predicate, final Supplier<C> factory); @Override VectorT<W,C> groupedUntil(final Predicate<? super T> predicate, final Supplier<C> factory); @Override VectorT<W,Vector<T>> grouped(final int groupSize); @Override VectorT<W,T> distinct(); @Override VectorT<W,T> scanLeft(final Monoid<T> monoid); @Override VectorT<W,U> scanLeft(final U seed, final BiFunction<? super U, ? super T, ? extends U> function); @Override VectorT<W,T> scanRight(final Monoid<T> monoid); @Override VectorT<W,U> scanRight(final U identity, final BiFunction<? super T, ? super U, ? extends U> combiner); @Override VectorT<W,T> sorted(); @Override VectorT<W,T> sorted(final Comparator<? super T> c); @Override VectorT<W,T> takeWhile(final Predicate<? super T> p); @Override VectorT<W,T> dropWhile(final Predicate<? super T> p); @Override VectorT<W,T> takeUntil(final Predicate<? super T> p); @Override VectorT<W,T> dropUntil(final Predicate<? super T> p); @Override VectorT<W,T> dropRight(final int num); @Override VectorT<W,T> takeRight(final int num); @Override VectorT<W,T> intersperse(final T value); @Override VectorT<W,T> reverse(); @Override VectorT<W,T> shuffle(); @Override VectorT<W,T> onEmpty(final T value); @Override VectorT<W,T> onEmptyGet(final Supplier<? extends T> supplier); @Override VectorT<W,T> shuffle(final Random random); @Override VectorT<W,T> slice(final long from, final long to); @Override VectorT<W,T> sorted(final Function<? super T, ? extends U> function); @Override int hashCode(); @Override boolean equals(final Object o); VectorT<W,R> forEach4M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                      BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                      Function3<? super T, ? super R1, ? super R2, ? extends VectorT<W,R3>> value3,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, ? extends R> yieldingFunction); VectorT<W,R> forEach4M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                      BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                      Function3<? super T, ? super R1, ? super R2, ? extends VectorT<W,R3>> value3,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, Boolean> filterFunction,
                                                      Function4<? super T, ? super R1, ? super R2, ? super R3, ? extends R> yieldingFunction); VectorT<W,R> forEach3M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                  BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                  Function3<? super T, ? super R1, ? super R2, ? extends R> yieldingFunction); VectorT<W,R> forEach3M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                                  BiFunction<? super T, ? super R1, ? extends VectorT<W,R2>> value2,
                                                  Function3<? super T, ? super R1, ? super R2, Boolean> filterFunction,
                                                  Function3<? super T, ? super R1, ? super R2, ? extends R> yieldingFunction); VectorT<W,R> forEach2M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                          BiFunction<? super T, ? super R1, ? extends R> yieldingFunction); VectorT<W,R> forEach2M(Function<? super T, ? extends VectorT<W,R1>> value1,
                                          BiFunction<? super T, ? super R1, Boolean> filterFunction,
                                          BiFunction<? super T, ? super R1, ? extends R> yieldingFunction); @Override VectorT<W,T> prependStream(Stream<? extends T> stream); @Override VectorT<W,T> appendAll(T... values); @Override VectorT<W,T> append(T value); @Override VectorT<W,T> prepend(T value); @Override VectorT<W,T> prependAll(T... values); @Override VectorT<W,T> insertAt(int pos, T... values); @Override VectorT<W,T> deleteBetween(int start, int end); @Override VectorT<W,T> insertStreamAt(int pos, Stream<T> stream); @Override VectorT<W,R> zip(BiFunction<? super T, ? super T2, ? extends R> fn, Publisher<? extends T2> publisher); @Override VectorT<W,Tuple2<T, U>> zipWithPublisher(Publisher<? extends U> other); @Override VectorT<W,R> zip3(Iterable<? extends S> second, Iterable<? extends U> third, Function3<? super T, ? super S, ? super U, ? extends R> fn3); @Override VectorT<W,R> zip4(Iterable<? extends T2> second, Iterable<? extends T3> third, Iterable<? extends T4> fourth, Function4<? super T, ? super T2, ? super T3, ? super T4, ? extends R> fn); @Override VectorT<W,T> removeStream(final Stream<? extends T> stream); @Override VectorT<W,U> ofType(final Class<? extends U> type); @Override VectorT<W,T> removeAll(final Iterable<? extends T> it); @Override VectorT<W,T> removeAll(final T... values); @Override VectorT<W,T> filterNot(final Predicate<? super T> predicate); @Override VectorT<W,T> retainAll(final Iterable<? extends T> it); @Override VectorT<W,T> notNull(); @Override VectorT<W,T> retainStream(final Stream<? extends T> stream); @Override VectorT<W,T> retainAll(final T... values); @Override VectorT<W,T> drop(final long num); @Override VectorT<W,T> take(final long num);  }