streams: Java Stream API + Collectors cookbook module (creation, laziness and short-circuiting, intermediate/terminal ops, Collectors recipes and toMap traps, primitive stream overflow, parallel traps, Gatherers on JDK 25, loop-to-stream conversion), 12 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b49nGy7tcEjVUa3WAA
This commit is contained in:
Claude
2026-11-24 05:52:24 +05:30
parent 9c2ae10d7f
commit 74da9cd899
28 changed files with 831 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
filter even : [2, 4, 6, 8, 10]
map toUpperCase : [HELLO, WORLD, JAVA]
map (no flatten) : [3, 2, 4] <- one result per inner list
flatMap(List::stream): [1, 2, 3, 4, 5, 6, 7, 8, 9]
mapMulti (dup evens): [1, 2, 2, 3, 4, 4]
sorted() : [Alice, Bob, Carol, Dave]
sorted(reverse) : [Dave, Carol, Bob, Alice]
sorted(len, alpha) : [Bob, Dave, Alice, Carol]
distinct() : [1, 2, 3, 4, 5]
limit(4) : [1, 2, 2, 3]
skip(5) : [3, 4, 5]
takeWhile(< 5) : [1, 2, 3]
dropWhile(< 5) : [10, 2, 1]
filter(< 5) : [1, 2, 3, 2, 1] <- not the same thing