Identify and apply modern Java (Java 8+) refactoring opportunities to improve readability, maintainability, and performance.
Prerequisites: Run ./mvnw compile or mvn compile before applying any changes. If compilation fails, stop immediately — do not proceed until the project compiles successfully.
Core areas: Lambda expressions and method references (over anonymous classes), Stream API for declarative collection processing, Optional for null-safe APIs, java.time API (replacing Date/Calendar), default interface methods, var type inference, unmodifiable collection factory methods (List.of(), Set.of(), Map.of()), CompletableFuture for composable async programming, text blocks for multi-line strings, Java 25 Fl...
最新の Java 機能 (Java 8 以降) を採用するために Java コードをリファクタリングする必要がある場合に使用します。これには、匿名クラスのラムダへの移行、反復子ループの Stream API への置き換え、null 安全性のための Optional の採用、従来の Date/Calendar から java.time への切り替え、コレクション ファクトリ メソッドの使用、非同期操作のための CompletableFuture への移行、テキスト ブロックの適用、var 推論、または柔軟なコンストラクター本体やモジュール インポート宣言などの Java 25 機能の活用が含まれます。 Skills-for-Java プロジェクトの一部 ソース: jabrena/cursor-rules-java。