Comprehensive examples and demonstrations of Java features from Java 8 through Java 25, showcasing the evolution of the Java language and platform.
- Practical Code Examples - Real-world demonstrations of modern Java features
- Comprehensive Test Suite - 160+ tests covering all major functionality
- Workshop Presentation - Complete slide deck covering Java evolution (
slides.md) - Java Tier List Presentation - Feature ranking and discussion format (
slides-java-tier-list.md) - Workshop Exercises - Hands-on labs with complete solutions (
workshop-exercises.md) - Data-Oriented Programming - Examples of records, sealed classes, and pattern matching working together
- Lambda expressions and method references
- Stream API with advanced collectors
- Optional for null safety
- Default and static methods in interfaces
- CompletableFuture for async programming
- JShell (Java REPL)
- Collection factory methods (
List.of(),Map.of()) - Local variable type inference (
var) - HTTP Client API
- String enhancements (
isBlank(),strip(),repeat())
- Text blocks for multi-line strings
- Records for immutable data classes
- Pattern matching for
instanceof - Switch expressions with
yield - Sealed classes for controlled inheritance
- Simple web server (
jwebserver) - Virtual threads for scalable concurrency
- Sequenced collections
- Pattern matching in switch
- Enhanced pattern matching with guards
- Unnamed variables with
_(Java 22) - Stream Gatherers (Java 24)
- Scoped Values (finalized in Java 25 LTS)
- Module Import Declarations (Java 25)
- Flexible Constructor Bodies (Java 25)
- Primitive types in patterns (3rd preview in Java 25)
- Structured Concurrency (5th preview in Java 25)
- Java 25 LTS - Latest Long-Term Support release with preview features enabled
- Gradle 9.1.0+ - Modern build tooling with Java 25 support
- JUnit 5.13.3 - Modern testing framework
- SonarCloud - Code quality analysis configured for educational code standards
# Clone the repository
git clone https://github.com/kousen/java_latest.git
cd java_latest
# Run all tests
./gradlew test
# Run a specific example
./gradlew run
# Generate code coverage report
./gradlew jacocoTestReportThe repository includes a comprehensive Slidev presentation:
# Install dependencies for PDF export
npm install
# Start the presentation
npx slidev slides.md
# Export to PDF
npx slidev export slides.md --format pdf- Start with Java 8 -
ProcessDictionaryV2.javashowcases functional programming - Explore Records - See
Person.java,Customer.javafor data classes - Pattern Matching - Check
UseShapes.javafor modern control flow - Virtual Threads -
VirtualThreadsDemo.javafor scalable concurrency - Data-Oriented Programming - Combine records, sealed classes, and pattern matching
- Review the slides -
slides.mdprovides comprehensive coverage - Work through exercises -
workshop-exercises.mdcontains hands-on labs - Check solutions - Complete implementations in
exercises.solutionspackage - Practice with examples - Explore the main codebase for real-world patterns
ProcessDictionaryV2- Comprehensive Stream API showcaseastropackage - HTTP Client with Result pattern (sealed interfaces)shapespackage - Sealed classes with pattern matchingVirtualThreadsDemo- Modern concurrency patterns
# Run all tests
./gradlew test
# Run tests for a specific package
./gradlew test --tests "*interfaces*"
# Run workshop solution tests
./gradlew test --tests "exercises.solutions.*"
# Run with coverage
./gradlew test jacocoTestReportJaCoCo reports are generated in build/reports/jacoco/test/html/index.html
- Modern Java Recipes by Kenneth Kousen
- Java Enhancement Proposals (JEPs)
- Java Almanac
Kenneth Kousen
- Website: kousenit.com
- Newsletter: Tales from the jar side
- Social: @kenkousen
This repository is actively maintained and updated with the latest Java features as they become available.