Skip to content

Instantly share code, notes, and snippets.

Created March 14, 2019 22:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
for-comprehension: Comparing combining data with and for-comprehension
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 =;
final List<Tuple3<Integer, String, String>> zipped3 = zipped
  .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(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment