/** * Peek at two data types simulatanously (typically to perform a side-effect with each data point) * * <pre> * {@code * MapX<String,Integer> map = MapXs.of("hello",2); * map.bipeek(s->System.out.pritnln("key = " + s),System.out::println); * } * </pre> * * @param c1 consumer for the first type * @param c2 consumer for the second type * @return New BiTransformable with the same data */ default BiTransformable<T1, T2> bipeek(final Consumer<? super T1> c1, final Consumer<? super T2> c2) { return bimap(input -> { c1.accept(input); return input; } , input -> { c2.accept(input); return input; }); }
@Override default LazyEither4<LT1, LT2, LT3, RT> bipeek(final Consumer<? super LT3> c1, final Consumer<? super RT> c2) { return (LazyEither4<LT1, LT2, LT3, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default LazyEither3<LT1, LT2, RT> bipeek(final Consumer<? super LT2> c1, final Consumer<? super RT> c2) { return (LazyEither3<LT1, LT2, RT>) BiTransformable.super.bipeek(c1, c2); }
/** * Peek at two data types simulatanously (typically to perform a side-effect with each data point) * * <pre> * {@code * MapX<String,Integer> map = MapXs.of("hello",2); * map.bipeek(s->System.out.pritnln("key = " + s),System.out::println); * } * </pre> * * @param c1 consumer for the first type * @param c2 consumer for the second type * @return New BiTransformable with the same data */ default BiTransformable<T1, T2> bipeek(final Consumer<? super T1> c1, final Consumer<? super T2> c2) { return bimap(input -> { c1.accept(input); return input; } , input -> { c2.accept(input); return input; }); }
@Override default Either<LT, RT> bipeek(Consumer<? super LT> c1, Consumer<? super RT> c2) { return (Either<LT, RT>)BiTransformable.super.bipeek(c1, c2); }
@Override default ImmutableMap<K, V> bipeek(Consumer<? super K> c1, Consumer<? super V> c2) { return (ImmutableMap<K,V>)BiTransformable.super.bipeek(c1,c2); }
@Override default LazyEither5<LT1, LT2, LT3, LT4, RT> bipeek(final Consumer<? super LT4> c1, final Consumer<? super RT> c2) { return (LazyEither5<LT1, LT2, LT3,LT4, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default Ior<LT, RT> bipeek(final Consumer<? super LT> c1, final Consumer<? super RT> c2) { return (Ior<LT, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default Either<LT, RT> bipeek(Consumer<? super LT> c1, Consumer<? super RT> c2) { return (Either<LT, RT>)BiTransformable.super.bipeek(c1, c2); }
@Override default ImmutableMap<K, V> bipeek(Consumer<? super K> c1, Consumer<? super V> c2) { return (ImmutableMap<K,V>)BiTransformable.super.bipeek(c1,c2); }
@Override default LazyEither4<LT1, LT2, LT3, RT> bipeek(final Consumer<? super LT3> c1, final Consumer<? super RT> c2) { return (LazyEither4<LT1, LT2, LT3, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default LazyEither5<LT1, LT2, LT3, LT4, RT> bipeek(final Consumer<? super LT4> c1, final Consumer<? super RT> c2) { return (LazyEither5<LT1, LT2, LT3,LT4, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default LazyEither3<LT1, LT2, RT> bipeek(final Consumer<? super LT2> c1, final Consumer<? super RT> c2) { return (LazyEither3<LT1, LT2, RT>) BiTransformable.super.bipeek(c1, c2); }
@Override default Ior<LT, RT> bipeek(final Consumer<? super LT> c1, final Consumer<? super RT> c2) { return (Ior<LT, RT>) BiTransformable.super.bipeek(c1, c2); }