daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // List.zip/zipWith
  2. final Option<String> option = Option.of("value");
  3. final Either<String, String> either = Either.right("yay");
  4. final Iterator<Integer> integers = Iterator.tabulate(5, value -> value + 1);
  5.  
  6. final List<Tuple2<Integer, String>> zipped = integers.zip(either);
  7. final List<Tuple3<Integer, String, String>> zipped3 = zipped
  8.   .zip(option)
  9.   .map(e -> Tuple.of(e._1._1, e._1._2, e._2));
  10.  
  11. //the same with for-comprehension
  12. final Iterator<Tuple3<Integer, String, String>> combined = API.For(
  13.   integers,
  14.   either,
  15.   option
  16. )
  17.   .yield(Tuple::of);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top