public interface BiTransformable<T1,T2>
Modifier and Type | Method and Description |
---|---|
<R1,R2> BiTransformable<R1,R2> |
bimap(java.util.function.Function<? super T1,? extends R1> fn1,
java.util.function.Function<? super T2,? extends R2> fn2)
Transform this BiTransformable, changing two value types at once.
|
default BiTransformable<T1,T2> |
bipeek(java.util.function.Consumer<? super T1> c1,
java.util.function.Consumer<? super T2> c2)
Peek at two data types simulatanously (typically to perform a side-effect with each data point)
|
<R1,R2> BiTransformable<R1,R2> bimap(java.util.function.Function<? super T1,? extends R1> fn1, java.util.function.Function<? super T2,? extends R2> fn2)
MapX<String,Integer> map = MapXs.of("hello",2);
MapX<String,Integer> transformedMap = map.bimap(s->s+" world",i->i*4);
//["hello world",8]
fn1
- transformation function for the first typefn2
- transformation function for the second typedefault BiTransformable<T1,T2> bipeek(java.util.function.Consumer<? super T1> c1, java.util.function.Consumer<? super T2> c2)
MapX<String,Integer> map = MapXs.of("hello",2);
map.bipeek(s->System.out.pritnln("key = " + s),System.out::println);
c1
- consumer for the first typec2
- consumer for the second type