Created
March 14, 2019 22:35
-
-
Save mchmielarz/619b9c540a198344dea947fc35e3a0a1 to your computer and use it in GitHub Desktop.
for-comprehension: Building a car with Java's for-comprehension
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
final Option<Car> car = For( | |
engine(), | |
wheels(), | |
body() | |
).yield( | |
(engine, wheels, body) -> new Car(body, engine, wheels) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment