@@ -39,6 +39,7 @@ are equivalent.
3939 - concatenated text: ` Collectors.joining ` ;
4040 - numeric primitive result: ` mapToInt ` /` mapToLong ` /` mapToDouble ` plus primitive stream terminal
4141 operations;
42+ - two independent aggregates over the same input on Java 12+: ` Collectors.teeing ` ;
4243 - grouping/indexing: ` groupingBy ` , downstream collectors, ` partitioningBy ` , or ` toMap ` with
4344 explicit merge/null handling.
44452 . Prefer stream terminal operations that encode intent directly: ` anyMatch ` for existence, ` count `
@@ -48,8 +49,8 @@ are equivalent.
4849 ` flatMap(Optional::stream) ` on Java 9+ for ` Stream<Optional<T>> ` . On Java 16+, consider
4950 ` mapMulti ` only when it makes a small zero-or-one/one-to-few transformation clearer or avoids
5051 many tiny stream allocations.
51- 4 . Use primitive streams for primitive aggregation. Keep ` reduce(identity, op) ` for immutable
52- non-primitive accumulation such as ` BigDecimal ` .
52+ 4 . Use primitive streams for primitive aggregation. Keep and explicitly classify `reduce(identity,
53+ op) ` as acceptable for immutable non-primitive accumulation such as ` BigDecimal`.
53545 . Choose collectors by result semantics, and state duplicate-key/null contracts explicitly. When a
5455 later step needs an expensive check result, carry ` element + result ` with a baseline-compatible
5556 holder; use ` Map.entry ` only on Java 9+ when both values are non-null.
0 commit comments