/** * 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; }); }
/** * 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; }); }