Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // List.zip/zipWith
- final Option<String> option = Option.of("value");
- final Either<String, String> either = Either.right("yay");
- final Iterator<Integer> integers = Iterator.tabulate(5, value -> value + 1);
- final List<Tuple2<Integer, String>> zipped = integers.zip(either);
- final List<Tuple3<Integer, String, String>> zipped3 = zipped
- .zip(option)
- .map(e -> Tuple.of(e._1._1, e._1._2, e._2));
- //the same with for-comprehension
- final Iterator<Tuple3<Integer, String, String>> combined = API.For(
- integers,
- either,
- option
- )
- .yield(Tuple::of);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement