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
_
- Primitive types in patterns (preview)
- Scoped Values (finalized in Java 25)
- Foreign Function & Memory API
- Java 24 - Latest features and compatibility with preview features enabled
- Gradle 8.14.3 - Modern build tooling with Java 24 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 jacocoTestReport
The 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.java
showcases functional programming - Explore Records - See
Person.java
,Customer.java
for data classes - Pattern Matching - Check
UseShapes.java
for modern control flow - Virtual Threads -
VirtualThreadsDemo.java
for scalable concurrency - Data-Oriented Programming - Combine records, sealed classes, and pattern matching
- Review the slides -
slides.md
provides comprehensive coverage - Work through exercises -
workshop-exercises.md
contains hands-on labs - Check solutions - Complete implementations in
exercises.solutions
package - Practice with examples - Explore the main codebase for real-world patterns
ProcessDictionaryV2
- Comprehensive Stream API showcaseastro
package - HTTP Client with Result pattern (sealed interfaces)shapes
package - 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 jacocoTestReport
JaCoCo 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.