@Test public void lazyMap() throws Exception { assertThat(t1.lazyMap(i->i+1),equalTo(Tuple.tuple(11))); t1.lazyMap(i->{ called++; return i+1; }); assertThat(called,equalTo(0)); }
public <R> Tuple1<R> lazyMap(Function<? super T, ? extends R> fn){ return lazy(()->fn.apply(_1())); }
Tuple1 implements To<Tuple1<T>>,
                                  Serializable,
                                  Transformable<T>,
                                  Filters<T>,
                                  EqualTo<tuple1,T,Tuple1<T>>,
                                  OrderedBy<tuple1,T,Tuple1<T>>,
                                  Comparable<Tuple1<T>>,
                                  Higher<tuple1,T> { public <R> Tuple1<R> lazyMap(Function<? super T, ? extends R> fn){ return lazy(()->fn.apply(_1())); } }
Tuple1 implements To<Tuple1<T>>,
                                  Serializable,
                                  Transformable<T>,
                                  Filters<T>,
                                  EqualTo<tuple1,T,Tuple1<T>>,
                                  OrderedBy<tuple1,T,Tuple1<T>>,
                                  Comparable<Tuple1<T>>,
                                  Higher<tuple1,T> { public <R> Tuple1<R> lazyMap(Function<? super T, ? extends R> fn){ return lazy(()->fn.apply(_1())); }  }
Tuple1 implements To<Tuple1<T>>,
                                  Serializable,
                                  Transformable<T>,
                                  Filters<T>,
                                  EqualTo<tuple1,T,Tuple1<T>>,
                                  OrderedBy<tuple1,T,Tuple1<T>>,
                                  Comparable<Tuple1<T>>,
                                  Higher<tuple1,T> { public <R> Tuple1<R> lazyMap(Function<? super T, ? extends R> fn){ return lazy(()->fn.apply(_1())); }  static Tuple1<T> of(T value); static Tuple1<T> lazy(Supplier<? extends T> supplier); Tuple1<T> memo(); T _1(); Tuple1<R> map(Function<? super T, ? extends R> fn); @Override Tuple1<T> peek(Consumer<? super T> c); Tuple1<T> eager(); @Override boolean equals(Object o); @Override int compareTo(Tuple1<T> o); @Override int hashCode(); Tuple1<R> lazyMap(Function<? super T, ? extends R> fn); Tuple1<R> zip(Tuple1<T2> t2,BiFunction<? super T,? super T2, ? extends R > zipper); Tuple1<R> lazyZip(Tuple1<T2> t2,BiFunction<? super T,? super T2, ? extends R > zipper); Tuple1<R> flatMap(Function<? super T, ? extends Tuple1<R>> fn); Tuple1<R> lazyFlatMap(Function<? super T, ? extends Tuple1<R>> fn); R fold(Function<? super T, ? extends R> fn); @Override String toString(); static Tuple1<T> narrowK(Higher<tuple1,T> ds); static Tuple1<R> tailRec(T initial, Function<? super T, ? extends Tuple1<? extends Either<T, R>>> fn); @Override Option<T> filter(Predicate<? super T> predicate); @Override Option<U> ofType(Class<? extends U> type); @Override Option<T> filterNot(Predicate<? super T> predicate); @Override Option<T> notNull(); final Object[] toArray(); Tuple2<T, T2> concat(Tuple1<T2> tuple); Tuple3<T, T2,T3> concat(Tuple2<T2,T3> tuple); Tuple4<T, T2, T3, T4> concat(Tuple3<T2, T3, T4> tuple); Tuple5<T, T2, T3, T4, T5> concat(Tuple4<T2, T3, T4, T5> tuple); Tuple6<T, T2, T3, T4, T5, T6> concat(Tuple5<T2, T3, T4, T5, T6> tuple); Tuple7<T, T2, T3, T4, T5, T6, T7> concat(Tuple6<T2, T3, T4, T5, T6, T7> tuple); Tuple8<T, T2, T3, T4, T5, T6, T7, T8> concat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple); Tuple2<T, T2> lazyConcat(Tuple1<T2> tuple); Tuple3<T, T2,T3> lazyConcat(Tuple2<T2,T3> tuple); Tuple4<T, T2, T3, T4> lazyConcat(Tuple3<T2, T3, T4> tuple); Tuple5<T, T2, T3, T4, T5> lazyConcat(Tuple4<T2, T3, T4, T5> tuple); Tuple6<T, T2, T3, T4, T5, T6> lazyConcat(Tuple5<T2, T3, T4, T5, T6> tuple); Tuple7<T, T2, T3, T4, T5, T6, T7> lazyConcat(Tuple6<T2, T3, T4, T5, T6, T7> tuple); Tuple8<T, T2, T3, T4, T5, T6, T7, T8> lazyConcat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple); }
Tuple1 implements To<Tuple1<T>>,
                                  Serializable,
                                  Transformable<T>,
                                  Filters<T>,
                                  EqualTo<tuple1,T,Tuple1<T>>,
                                  OrderedBy<tuple1,T,Tuple1<T>>,
                                  Comparable<Tuple1<T>>,
                                  Higher<tuple1,T> { public <R> Tuple1<R> lazyMap(Function<? super T, ? extends R> fn){ return lazy(()->fn.apply(_1())); }  static Tuple1<T> of(T value); static Tuple1<T> lazy(Supplier<? extends T> supplier); Tuple1<T> memo(); T _1(); Tuple1<R> map(Function<? super T, ? extends R> fn); @Override Tuple1<T> peek(Consumer<? super T> c); Tuple1<T> eager(); @Override boolean equals(Object o); @Override int compareTo(Tuple1<T> o); @Override int hashCode(); Tuple1<R> lazyMap(Function<? super T, ? extends R> fn); Tuple1<R> zip(Tuple1<T2> t2,BiFunction<? super T,? super T2, ? extends R > zipper); Tuple1<R> lazyZip(Tuple1<T2> t2,BiFunction<? super T,? super T2, ? extends R > zipper); Tuple1<R> flatMap(Function<? super T, ? extends Tuple1<R>> fn); Tuple1<R> lazyFlatMap(Function<? super T, ? extends Tuple1<R>> fn); R fold(Function<? super T, ? extends R> fn); @Override String toString(); static Tuple1<T> narrowK(Higher<tuple1,T> ds); static Tuple1<R> tailRec(T initial, Function<? super T, ? extends Tuple1<? extends Either<T, R>>> fn); @Override Option<T> filter(Predicate<? super T> predicate); @Override Option<U> ofType(Class<? extends U> type); @Override Option<T> filterNot(Predicate<? super T> predicate); @Override Option<T> notNull(); final Object[] toArray(); Tuple2<T, T2> concat(Tuple1<T2> tuple); Tuple3<T, T2,T3> concat(Tuple2<T2,T3> tuple); Tuple4<T, T2, T3, T4> concat(Tuple3<T2, T3, T4> tuple); Tuple5<T, T2, T3, T4, T5> concat(Tuple4<T2, T3, T4, T5> tuple); Tuple6<T, T2, T3, T4, T5, T6> concat(Tuple5<T2, T3, T4, T5, T6> tuple); Tuple7<T, T2, T3, T4, T5, T6, T7> concat(Tuple6<T2, T3, T4, T5, T6, T7> tuple); Tuple8<T, T2, T3, T4, T5, T6, T7, T8> concat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple); Tuple2<T, T2> lazyConcat(Tuple1<T2> tuple); Tuple3<T, T2,T3> lazyConcat(Tuple2<T2,T3> tuple); Tuple4<T, T2, T3, T4> lazyConcat(Tuple3<T2, T3, T4> tuple); Tuple5<T, T2, T3, T4, T5> lazyConcat(Tuple4<T2, T3, T4, T5> tuple); Tuple6<T, T2, T3, T4, T5, T6> lazyConcat(Tuple5<T2, T3, T4, T5, T6> tuple); Tuple7<T, T2, T3, T4, T5, T6, T7> lazyConcat(Tuple6<T2, T3, T4, T5, T6, T7> tuple); Tuple8<T, T2, T3, T4, T5, T6, T7, T8> lazyConcat(Tuple7<T2, T3, T4, T5, T6, T7, T8> tuple);  }