Why this matters
Fewer passes reduce allocations and CPU.
Combine filters/maps to minimize passes; avoid creating intermediate collections unnecessarily.
Fewer passes reduce allocations and CPU.
Side-by-side examples engineers can pattern-match during review.
var out = xs.stream().filter(p).map(f).filter(q).collect(toList());var out = xs.stream().reduce(new ArrayList<R>(), (acc,x) -> {
if(!p.test(x)) return acc; var y = f.apply(x); if(q.test(y)) acc.add(y); return acc;
}, (a,b) -> { a.addAll(b); return a; });list.stream().map(...).collect(toList()).stream()single pipeline; defer collectFrom 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.