
Java 21
- 276 installs
- 614 repo stars
- Updated March 28, 2026
- gentleman-programming/gentleman-skills
For development and infrastructure management.
About
java-21 is an AI coding tool that enhances development workflows. Builders use it for infrastructure, integration, and platform development within the catalog ecosystem.
- java-21
- Development
Java 21 by the numbers
- 276 all-time installs (skills.sh)
- Ranked #1,403 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/gentleman-programming/gentleman-skills --skill java-21Add your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 276 |
|---|---|
| repo stars | ★ 614 |
| Last updated | March 28, 2026 |
| Repository | gentleman-programming/gentleman-skills ↗ |
What it does
For development and infrastructure management.
Files
When to Use
Load this skill when:
- Writing Java 21 application or library code
- Designing immutable DTOs or value objects
- Modeling closed hierarchies with sealed types
- Using virtual threads for blocking I/O
Critical Patterns
Pattern 1: Records for immutable data
Use records for DTOs and value objects, validate in compact constructors.
Pattern 2: Sealed types + pattern matching
Use sealed interfaces/classes and switch pattern matching for exhaustiveness.
Pattern 3: Virtual threads for I/O
Use virtual threads to handle blocking I/O without large thread pools.
Code Examples
Example 1: Record with validation
package com.acme.user;
public record Email(String value) {
public Email {
if (value == null || !value.contains("@")) {
throw new IllegalArgumentException("Invalid email");
}
}
}Example 2: Sealed hierarchy + switch pattern matching
package com.acme.payment;
public sealed interface Payment permits Card, BankTransfer { }
public record Card(String last4) implements Payment { }
public record BankTransfer(String iban) implements Payment { }
public final class PaymentPrinter {
public String describe(Payment payment) {
return switch (payment) {
case Card card -> "card-" + card.last4();
case BankTransfer bank -> "iban-" + bank.iban();
};
}
}Example 3: Virtual threads for blocking calls
package com.acme.io;
import java.util.concurrent.Executors;
public final class Fetcher {
public void fetchAll(java.util.List<String> urls) throws Exception {
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
for (String url : urls) {
executor.submit(() -> blockingFetch(url));
}
}
}
private void blockingFetch(String url) {
// perform blocking I/O here
}
}Anti-Patterns
Don't: Use mutable data carriers
// BAD: mutable DTO
public class UserDto {
public String name;
public String email;
}Don't: Spin up raw platform threads per request
// BAD: expensive and unbounded
new Thread(() -> blockingFetch("https://api" )).start();Quick Reference
| Task | Pattern |
|---|---|
| Immutable DTOs | Use records with validation |
| Closed hierarchies | Use sealed interfaces + switch |
| Blocking I/O scale | Use virtual threads executor |
Resources
- Java 21 Release Notes: https://www.oracle.com/java/technologies/javase/21-relnote-issues.html
- JEP Index: https://openjdk.org/jeps/0
Related skills
Backend & APIsbackend