A comprehensive training course covering modern Java features from Java 8 and beyond, with a focus on functional programming techniques.
Instructor: Ken Kousen
Created: July 2016
Last Updated: May 2025
This course teaches developers how to use the functional programming features introduced in Java 8 and enhanced in subsequent versions. Students will learn to use lambda expressions, method references, streams, and other modern Java features to write more expressive and maintainable code.
- Solid understanding of Java fundamentals
- Experience with object-oriented programming
- Java 8 or later installed (Java 17+ recommended)
java_upgrade/
├── src/
│ ├── main/java/ # Demo code and examples
│ │ ├── concurrency/ # CompletableFuture demonstrations
│ │ ├── datetime/ # Date/time API examples
│ │ ├── got/ # Game of Thrones data model
│ │ ├── interfaces/ # Interface evolution examples
│ │ ├── io/ # I/O processing examples
│ │ ├── lambdas/ # Lambda expression demos
│ │ ├── lazy/ # Lazy evaluation patterns
│ │ ├── optional/ # Optional usage examples
│ │ ├── sorting/ # Comparator and sorting demos
│ │ └── streams/ # Stream operation examples
│ └── test/java/ # Hands-on exercises
│ ├── concurrency/ # CompletableFuture exercises
│ ├── got/ # Advanced stream exercises
│ ├── interfaces/ # Interface implementation
│ ├── lambdas/ # Functional interface exercises
│ ├── optional/ # Optional pattern exercises
│ ├── sorting/ # Comparator exercises
│ └── streams/ # Stream operation exercises
├── labs.md # Comprehensive exercise guide
├── CLAUDE.md # Project context for Claude Code
└── Java_Upgrade_Slides.pdf # Course presentation slides
- Consumer, Supplier, Predicate, and Function interfaces
- Lambda expression syntax and evolution
- Method references and constructor references
- Functional interface composition
- Lazy evaluation patterns with Supplier
- Creating and transforming streams
- Filtering, mapping, and reducing operations
- Collectors and advanced aggregations
- FlatMap for nested structures
- Parallel stream processing
- Performance considerations
- Optional creation and usage patterns
- Chaining operations with map and flatMap
- Best practices and anti-patterns
- Integration with DAO patterns
- Comparator.comparing() and thenComparing()
- Reverse ordering and custom comparisons
- Sorting with records
- Partitioning and grouping
- LocalDate, LocalTime, and LocalDateTime
- Time zones and ZonedDateTime
- Duration and Period calculations
- Formatting and parsing
- Asynchronous programming patterns
- Chaining and combining futures
- Exception handling in async code
- Virtual threads (Java 21+)
- Default and static methods
- Multiple inheritance considerations
- Functional interfaces in the JDK
- Records as data carriers
- BigDecimal operations with streams
- Parallel processing best practices
The course includes 20 comprehensive exercises covering all major topics:
-
Lambda Expressions (Exercises 1-8)
- Functional interface implementations
- Method reference patterns
- Lambda evolution examples
- Lazy evaluation
-
Stream Operations (Exercises 9-15)
- Basic stream operations
- Advanced collectors
- Parallel streams
- BigDecimal reduce operations
-
Advanced Features (Exercises 16-20)
- Optional patterns
- CompletableFuture
- Interface implementation
- Complex stream operations
See labs.md for detailed exercise instructions.
# Run all tests
./gradlew test
# Run specific test class
./gradlew test --tests "lambdas.FunctionalInterfacesTest"
# Run specific test method
./gradlew test --tests "lambdas.FunctionalInterfacesTest.implementConsumerUsingLambda"
Most modern IDEs (IntelliJ IDEA, Eclipse, VS Code) support running JUnit tests directly:
- Open the test file
- Click the run button next to the test method or class
- View results in the test runner panel
main
- Contains exercises with TODO comments for studentssolutions
- Contains complete solutions for all exercises- Training branches (e.g.,
java_jan2025
) - Course-specific snapshots
-
Clone the repository:
git clone https://github.com/kousen/java_upgrade.git cd java_upgrade
-
Ensure Java is installed:
java -version # Should show Java 17 or later
-
Build the project:
./gradlew build
-
Open labs.md and start with Exercise 1
-
Run tests to verify your solutions:
./gradlew test
- Course Slides:
Java_Upgrade_Slides.pdf
(dated, but still useful) - Demo Code: Browse
src/main/java
for working examples - Solutions: Check out the
solutions
branch to see completed exercises - Java Documentation: Official Java Documentation
Ken Kousen
- Email: [email protected]
- Bluesky: @kousenit.com
- LinkedIn: Ken Kousen
- Website: www.kousenit.com
- Mockito Made Clear (Pragmatic Bookshelf, 2023)
- Help Your Boss Help You (Pragmatic Bookshelf, 2021)
- Kotlin Cookbook (O'Reilly, 2019)
- Modern Java Recipes (O'Reilly, 2017)
- Gradle Recipes for Android (O'Reilly, 2016)
- Making Java Groovy (Manning, 2013)
This project is licensed under the MIT License - see the LICENSE file for details.
Special thanks to all students and organizations who have taken this course and provided valuable feedback to improve the material.
Note: This is an active training repository. Content is regularly updated to reflect the latest Java features and best practices.