A set of exercises to teach use of Java 8 lambda syntax, and the new Streams API.
To follow the exercises:
- fork and clone the repository
- ensure you have a correctly configured, lambda-enabled Java build
- Maven can help generate configuration for your favourite IDE, though you will likely have to set the JDK manually
- ensure your cloned project, particularly the class
ConfigureYourLambdaBuildOfJdk
compiles and runs correctly
- navigate to the first exercise,
Exercise_1_Test
(tests are insrc/test/java
, in the packageorg.adoptopenjdk.lambda.tutorial
) - read background information in the JavaDoc, and follow instructions, making the test pass
- to find solutions check out different branches of the project. Two flavours of solutions are available: what it might have looked like before JDK 8, and what it might look like after JDK 8. Those are in branches
solutions-prejava8
andsolutions-postjava8
respectively.
- Internal vs External Iteration (the forEach method)
- Filtering and Collecting
- Mapping
- Method References
[More to come]
Early access builds of JDK 8 are available here.
The current tutorial is known to work with the following JDK build:
JDK Build Number | Released On |
---|---|
ea b109 | Sep 26, 2013 |
lambda-tutorial will try to track against the newest version available. If you find that you are working with a newer version of the Lambda JDK and the tutorial does not compile or run, please file an issue.
- IntelliJ IDEA on Ubuntu
- IntelliJ IDEA on MacOS
- IntelliJ IDEA deutsche Anleitung (u.a. Windows)
- Eclipse Kepler 4.3 on Windows
Note: we are hoping the instructions are not too sensitive to the OSes on which they have been performed.