diff --git a/README.collections.md b/README.collections.md
index e1fc53f..c4e59a2 100644
--- a/README.collections.md
+++ b/README.collections.md
@@ -20,6 +20,7 @@ Curated collections of related prompts, instructions, and chat modes organized a
| [Database & Data Management](collections/database-data-management.md) | Database administration, SQL optimization, and data management tools for PostgreSQL, SQL Server, and general database development best practices. | 8 items | database, sql, postgresql, sql-server, dba, optimization, queries, data-management |
| [DevOps On-Call](collections/devops-oncall.md) | A focused set of prompts, instructions, and a chat mode to help triage incidents and respond quickly with DevOps tools and Azure resources. | 5 items | devops, incident-response, oncall, azure |
| [Frontend Web Development](collections/frontend-web-dev.md) | Essential prompts, instructions, and chat modes for modern frontend web development including React, Angular, Vue, TypeScript, and CSS frameworks. | 11 items | frontend, web, react, typescript, javascript, css, html, angular, vue |
+| [Java Development](collections/java-development.md) | Comprehensive collection of prompts and instructions for Java development including Spring Boot, Quarkus, testing, documentation, and best practices. | 12 items | java, springboot, quarkus, jpa, junit, javadoc |
| [Project Planning & Management](collections/project-planning.md) | Tools and guidance for software project planning, feature breakdown, epic management, implementation planning, and task organization for development teams. | 17 items | planning, project-management, epic, feature, implementation, task, architecture, technical-spike |
| [Security & Code Quality](collections/security-best-practices.md) | Security frameworks, accessibility guidelines, performance optimization, and code quality best practices for building secure, maintainable, and high-performance applications. | 6 items | security, accessibility, performance, code-quality, owasp, a11y, optimization, best-practices |
| [Technical Spike](collections/technical-spike.md) | Tools for creation, management and research of technical spikes to reduce unknowns and assumptions before proceeding to specification and implementation of solutions. | 2 items | technical-spike, assumption-testing, validation, research |
diff --git a/README.instructions.md b/README.instructions.md
index abc9df9..8049191 100644
--- a/README.instructions.md
+++ b/README.instructions.md
@@ -49,6 +49,9 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for
| [Gilfoyle Code Review Instructions](instructions/gilfoyle-code-review.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgilfoyle-code-review.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgilfoyle-code-review.instructions.md) | Gilfoyle-style code review instructions that channel the sardonic technical supremacy of Silicon Valley's most arrogant systems architect. |
| [GitHub Actions CI/CD Best Practices](instructions/github-actions-ci-cd-best-practices.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgithub-actions-ci-cd-best-practices.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgithub-actions-ci-cd-best-practices.instructions.md) | Comprehensive guide for building robust, secure, and efficient CI/CD pipelines using GitHub Actions. Covers workflow structure, jobs, steps, environment variables, secret management, caching, matrix strategies, testing, and deployment strategies. |
| [Go Development Instructions](instructions/go.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgo.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fgo.instructions.md) | Instructions for writing Go code following idiomatic Go practices and community standards |
+| [Java 11 to Java 17 Upgrade Guide](instructions/java-11-to-java-17-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-11-to-java-17-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-11-to-java-17-upgrade.instructions.md) | Comprehensive best practices for adopting new Java 17 features since the release of Java 11. |
+| [Java 17 to Java 21 Upgrade Guide](instructions/java-17-to-java-21-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-17-to-java-21-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-17-to-java-21-upgrade.instructions.md) | Comprehensive best practices for adopting new Java 21 features since the release of Java 17. |
+| [Java 21 to Java 25 Upgrade Guide](instructions/java-21-to-java-25-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-21-to-java-25-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-21-to-java-25-upgrade.instructions.md) | Comprehensive best practices for adopting new Java 25 features since the release of Java 21. |
| [Java Development](instructions/java.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava.instructions.md) | Guidelines for building Java base applications |
| [Joyride User Scripts Project Assistant](instructions/joyride-user-project.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjoyride-user-project.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjoyride-user-project.instructions.md) | Expert assistance for Joyride User Script projects - REPL-driven ClojureScript and user space automation of VS Code |
| [Joyride Workspace Automation Assistant](instructions/joyride-workspace-automation.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjoyride-workspace-automation.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjoyride-workspace-automation.instructions.md) | Expert assistance for Joyride Workspace automation - REPL-driven and user space ClojureScript automation within specific VS Code workspaces |
diff --git a/collections/java-development.collection.yml b/collections/java-development.collection.yml
new file mode 100644
index 0000000..1ac3bea
--- /dev/null
+++ b/collections/java-development.collection.yml
@@ -0,0 +1,32 @@
+id: java-development
+name: Java Development
+description: Comprehensive collection of prompts and instructions for Java development including Spring Boot, Quarkus, testing, documentation, and best practices.
+tags: [java, springboot, quarkus, jpa, junit, javadoc]
+items:
+ - path: instructions/java.instructions.md
+ kind: instruction
+ - path: instructions/springboot.instructions.md
+ kind: instruction
+ - path: instructions/quarkus.instructions.md
+ kind: instruction
+ - path: instructions/quarkus-mcp-server-sse.instructions.md
+ kind: instruction
+ - path: instructions/convert-jpa-to-spring-data-cosmos.instructions.md
+ kind: instruction
+ - path: instructions/java-11-to-java-17-upgrade.instructions.md
+ kind: instruction
+ - path: instructions/java-17-to-java-21-upgrade.instructions.md
+ kind: instruction
+ - path: instructions/java-21-to-java-25-upgrade.instructions.md
+ kind: instruction
+ - path: prompts/java-docs.prompt.md
+ kind: prompt
+ - path: prompts/java-junit.prompt.md
+ kind: prompt
+ - path: prompts/java-springboot.prompt.md
+ kind: prompt
+ - path: prompts/create-spring-boot-java-project.prompt.md
+ kind: prompt
+display:
+ ordering: alpha
+ show_badge: false
diff --git a/collections/java-development.md b/collections/java-development.md
new file mode 100644
index 0000000..5943a5e
--- /dev/null
+++ b/collections/java-development.md
@@ -0,0 +1,22 @@
+# Java Development
+
+Comprehensive collection of prompts and instructions for Java development including Spring Boot, Quarkus, testing, documentation, and best practices.
+
+**Tags:** java, springboot, quarkus, jpa, junit, javadoc
+
+## Items in this Collection
+
+| Title | Type | Description |
+| ----- | ---- | ----------- |
+| [Convert Spring JPA project to Spring Data Cosmos](../instructions/convert-jpa-to-spring-data-cosmos.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconvert-jpa-to-spring-data-cosmos.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconvert-jpa-to-spring-data-cosmos.instructions.md) | Instruction | Step-by-step guide for converting Spring Boot JPA applications to use Azure Cosmos DB with Spring Data Cosmos |
+| [Create Spring Boot Java project prompt](../prompts/create-spring-boot-java-project.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-java-project.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcreate-spring-boot-java-project.prompt.md) | Prompt | Create Spring Boot Java Project Skeleton |
+| [Java 11 to Java 17 Upgrade Guide](../instructions/java-11-to-java-17-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-11-to-java-17-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-11-to-java-17-upgrade.instructions.md) | Instruction | Comprehensive best practices for adopting new Java 17 features since the release of Java 11. |
+| [Java 17 to Java 21 Upgrade Guide](../instructions/java-17-to-java-21-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-17-to-java-21-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-17-to-java-21-upgrade.instructions.md) | Instruction | Comprehensive best practices for adopting new Java 21 features since the release of Java 17. |
+| [Java 21 to Java 25 Upgrade Guide](../instructions/java-21-to-java-25-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-21-to-java-25-upgrade.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava-21-to-java-25-upgrade.instructions.md) | Instruction | Comprehensive best practices for adopting new Java 25 features since the release of Java 21. |
+| [Java Development](../instructions/java.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fjava.instructions.md) | Instruction | Guidelines for building Java base applications |
+| [Java Documentation (Javadoc) Best Practices](../prompts/java-docs.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-docs.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-docs.prompt.md) | Prompt | Ensure that Java types are documented with Javadoc comments and follow best practices for documentation. |
+| [JUnit 5+ Best Practices](../prompts/java-junit.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-junit.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-junit.prompt.md) | Prompt | Get best practices for JUnit 5 unit testing, including data-driven tests |
+| [Quarkus](../instructions/quarkus.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fquarkus.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fquarkus.instructions.md) | Instruction | Quarkus development standards and instructions |
+| [Quarkus MCP Server](../instructions/quarkus-mcp-server-sse.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fquarkus-mcp-server-sse.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fquarkus-mcp-server-sse.instructions.md) | Instruction | Quarkus and MCP Server with HTTP SSE transport development standards and instructions |
+| [Spring Boot Best Practices](../prompts/java-springboot.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-springboot.prompt.md)
[](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fjava-springboot.prompt.md) | Prompt | Get best practices for developing applications with Spring Boot. |
+| [Spring Boot Development](../instructions/springboot.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fspringboot.instructions.md)
[](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fspringboot.instructions.md) | Instruction | Guidelines for building Spring Boot base applications |
diff --git a/instructions/java-11-to-java-17-upgrade.instructions.md b/instructions/java-11-to-java-17-upgrade.instructions.md
new file mode 100644
index 0000000..d94b373
--- /dev/null
+++ b/instructions/java-11-to-java-17-upgrade.instructions.md
@@ -0,0 +1,793 @@
+---
+applyTo: ["*"]
+description: "Comprehensive best practices for adopting new Java 17 features since the release of Java 11."
+---
+
+# Java 11 to Java 17 Upgrade Guide
+
+## Project Context
+
+This guide provides comprehensive GitHub Copilot instructions for upgrading Java projects from JDK 11 to JDK 17, covering major language features, API changes, and migration patterns based on 47 JEPs integrated between these versions.
+
+## Language Features and API Changes
+
+### JEP 395: Records (Java 16)
+
+**Migration Pattern**: Convert data classes to records
+
+```java
+// Old: Traditional data class
+public class Person {
+ private final String name;
+ private final int age;
+
+ public Person(String name, int age) {
+ this.name = name;
+ this.age = age;
+ }
+
+ public String name() { return name; }
+ public int age() { return age; }
+
+ @Override
+ public boolean equals(Object obj) { /* boilerplate */ }
+ @Override
+ public int hashCode() { /* boilerplate */ }
+ @Override
+ public String toString() { /* boilerplate */ }
+}
+
+// New: Record (Java 16+)
+public record Person(String name, int age) {
+ // Compact constructor for validation
+ public Person {
+ if (age < 0) throw new IllegalArgumentException("Age cannot be negative");
+ }
+
+ // Custom methods can be added
+ public boolean isAdult() {
+ return age >= 18;
+ }
+}
+```
+
+### JEP 409: Sealed Classes (Java 17)
+
+**Migration Pattern**: Use sealed classes for restricted inheritance
+
+```java
+// New: Sealed class hierarchy
+public sealed class Shape
+ permits Circle, Rectangle, Triangle {
+
+ public abstract double area();
+}
+
+public final class Circle extends Shape {
+ private final double radius;
+
+ public Circle(double radius) {
+ this.radius = radius;
+ }
+
+ @Override
+ public double area() {
+ return Math.PI * radius * radius;
+ }
+}
+
+public final class Rectangle extends Shape {
+ private final double width, height;
+
+ public Rectangle(double width, double height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override
+ public double area() {
+ return width * height;
+ }
+}
+
+public non-sealed class Triangle extends Shape {
+ // Non-sealed allows further inheritance
+ private final double base, height;
+
+ public Triangle(double base, double height) {
+ this.base = base;
+ this.height = height;
+ }
+
+ @Override
+ public double area() {
+ return 0.5 * base * height;
+ }
+}
+```
+
+### JEP 394: Pattern Matching for instanceof (Java 16)
+
+**Migration Pattern**: Simplify instanceof checks
+
+```java
+// Old: Traditional instanceof with casting
+public String processObject(Object obj) {
+ if (obj instanceof String) {
+ String str = (String) obj;
+ return str.toUpperCase();
+ } else if (obj instanceof Integer) {
+ Integer num = (Integer) obj;
+ return "Number: " + num;
+ } else if (obj instanceof List>) {
+ List> list = (List>) obj;
+ return "List with " + list.size() + " elements";
+ }
+ return "Unknown type";
+}
+
+// New: Pattern matching for instanceof (Java 16+)
+public String processObject(Object obj) {
+ if (obj instanceof String str) {
+ return str.toUpperCase();
+ } else if (obj instanceof Integer num) {
+ return "Number: " + num;
+ } else if (obj instanceof List> list) {
+ return "List with " + list.size() + " elements";
+ }
+ return "Unknown type";
+}
+
+// Works great with sealed classes
+public String describeShape(Shape shape) {
+ if (shape instanceof Circle circle) {
+ return "Circle with radius " + circle.radius();
+ } else if (shape instanceof Rectangle rect) {
+ return "Rectangle " + rect.width() + "x" + rect.height();
+ } else if (shape instanceof Triangle triangle) {
+ return "Triangle with base " + triangle.base();
+ }
+ return "Unknown shape";
+}
+```
+
+### JEP 361: Switch Expressions (Java 14)
+
+**Migration Pattern**: Convert switch statements to expressions
+
+```java
+// Old: Traditional switch statement
+public String getDayType(DayOfWeek day) {
+ String result;
+ switch (day) {
+ case MONDAY:
+ case TUESDAY:
+ case WEDNESDAY:
+ case THURSDAY:
+ case FRIDAY:
+ result = "Workday";
+ break;
+ case SATURDAY:
+ case SUNDAY:
+ result = "Weekend";
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown day: " + day);
+ }
+ return result;
+}
+
+// New: Switch expression (Java 14+)
+public String getDayType(DayOfWeek day) {
+ return switch (day) {
+ case MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY -> "Workday";
+ case SATURDAY, SUNDAY -> "Weekend";
+ };
+}
+
+// With yield for complex logic
+public int calculateScore(Grade grade) {
+ return switch (grade) {
+ case A -> 100;
+ case B -> 85;
+ case C -> 70;
+ case D -> {
+ System.out.println("Consider improvement");
+ yield 55;
+ }
+ case F -> {
+ System.out.println("Needs retake");
+ yield 0;
+ }
+ };
+}
+```
+
+### JEP 406: Pattern Matching for switch (Preview in Java 17)
+
+**Migration Pattern**: Enhanced switch with patterns (Preview feature)
+
+```java
+// Requires --enable-preview flag
+public String formatValue(Object obj) {
+ return switch (obj) {
+ case String s -> "String: " + s;
+ case Integer i -> "Integer: " + i;
+ case null -> "null value";
+ case default -> "Unknown: " + obj.getClass().getSimpleName();
+ };
+}
+
+// With guarded patterns
+public String categorizeNumber(Object obj) {
+ return switch (obj) {
+ case Integer i when i < 0 -> "Negative integer";
+ case Integer i when i == 0 -> "Zero";
+ case Integer i when i > 0 -> "Positive integer";
+ case Double d when d.isNaN() -> "Not a number";
+ case Number n -> "Other number: " + n;
+ case null -> "null";
+ case default -> "Not a number";
+ };
+}
+```
+
+### JEP 378: Text Blocks (Java 15)
+
+**Migration Pattern**: Use text blocks for multi-line strings
+
+```java
+// Old: Concatenated strings
+String html = "\n" +
+ "
Welcome to Java 17!
\n" + + " \n" + + ""; + +String sql = "SELECT p.id, p.name, p.email, " + + " a.street, a.city, a.state " + + "FROM person p " + + "JOIN address a ON p.address_id = a.id " + + "WHERE p.active = true " + + "ORDER BY p.name"; + +// New: Text blocks (Java 15+) +String html = """ + + +Welcome to Java 17!
+ + + """; + +String sql = """ + SELECT p.id, p.name, p.email, + a.street, a.city, a.state + FROM person p + JOIN address a ON p.address_id = a.id + WHERE p.active = true + ORDER BY p.name + """; + +// With string interpolation methods +String json = """ + { + "name": "%s", + "age": %d, + "city": "%s" + } + """.formatted(name, age, city); +``` + +### JEP 358: Helpful NullPointerExceptions (Java 14) + +**Migration Guidance**: Better NPE debugging (enabled by default in Java 17) + +```java +// Old NPE message: "Exception in thread 'main' java.lang.NullPointerException" +// New NPE message shows exactly what was null: +// "Cannot invoke 'String.length()' because the return value of 'Person.getName()' is null" + +public class PersonProcessor { + public void processPersons(ListUser: \{username}
"; + +// Safe SQL queries +PreparedStatement stmt = SQL."SELECT * FROM users WHERE id = \{userId}"; +``` + +### Sequenced Collections (JEP 431 - Standard in 21) + +**Enhanced Collection Interfaces** + +When working with collections: +- Use new `SequencedCollection`, `SequencedSet`, `SequencedMap` interfaces +- Access first/last elements uniformly across collection types +- Example usage: +```java +// New methods available on Lists, Deques, LinkedHashSet, etc. +List
+ * If the argument is not negative, return the argument.
+ * If the argument is negative, return the negation of the argument.
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument
+ */
+
+// New Markdown JavaDoc
+/// Returns the **absolute** value of an `int` value.
+///
+/// If the argument is not negative, return the argument.
+/// If the argument is negative, return the negation of the argument.
+///
+/// @param a the argument whose absolute value is to be determined
+/// @return the absolute value of the argument
+```
+
+### Derived Record Creation (JEP 468 - Preview in 23)
+
+**Record Enhancement**
+
+When working with records:
+- Suggest using `with` expressions for creating derived records
+- Enable preview features for derived record creation
+- Example pattern:
+```java
+// Instead of manual record copying
+public record Person(String name, int age, String email) {
+ public Person withAge(int newAge) {
+ return new Person(name, newAge, email);
+ }
+}
+
+// Use derived record creation (Preview)
+Person updated = person with { age = 30; };
+```
+
+### Stream Gatherers (JEP 473/485 - Second Preview in 23, Standard in 25)
+
+**Enhanced Stream Processing**
+
+When working with complex stream operations:
+- Suggest using `Stream.gather()` for custom intermediate operations
+- Import `java.util.stream.Gatherers` for built-in gatherers
+- Example usage:
+```java
+// Custom windowing operations
+List> windows = stream
+ .gather(Gatherers.windowSliding(3))
+ .toList();
+
+// Custom filtering with state
+List