Last active
September 26, 2016 11:59
-
-
Save rikvdkleij/c6aaad2707ec0564a314af2dffc21503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In Scala I can do: | |
Option<Response> responseForTransaction = Option(getResponseForTransaction(transaction)) | |
responseForTransaction match { | |
case Some(r) => // do something with r | |
case None => .... | |
} | |
In Javaslang I tried this: | |
Option<Response> responseForTransaction = getResponseForTransaction(transaction); | |
Match(responseForTransaction).of( | |
Case(Option($())), r -> .....) | |
Case(None()), ....) | |
) |
Or:
responseForTransaction.<Runnable>map(r -> () -> { ....}).getOrElse(() -> .... ).run();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javaslang currently has the
API.run()
method in order to perform side-effect.But we still work on something better, e.g.
Maybe it will be
run()
instead ofof()
. And we will need Comsumer1..8.