Why this matters
Reduces CPU/GCs and improves throughput.
Hoist and reuse costly objects (Pattern, DateTimeFormatter) rather than re-creating per use.
Reduces CPU/GCs and improves throughput.
Side-by-side examples engineers can pattern-match during review.
Pattern p = Pattern.compile(pattern);
for (var s: list) { p = Pattern.compile(pattern); p.matcher(s).find(); }Pattern P = Pattern.compile(pattern);
for (var s: list) { P.matcher(s).find(); }new DateTimeFormatterBuilder() in loopstatic final Pattern P = Pattern.compile(...)From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.