Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b49nGy7tcEjVUa3WAA
18 lines
609 B
Plaintext
18 lines
609 B
Plaintext
== 1. The straightforward conversion ==
|
|
loop : {IN=1200.0, US=2300.0}
|
|
stream : {IN=1200.0, US=2300.0}
|
|
equal : true
|
|
|
|
== 2. A loop with break becomes findFirst, not filter ==
|
|
loop : ankur/laptop
|
|
stream : ankur/laptop
|
|
|
|
== 3. The list a loop built was mutable; toList() is not ==
|
|
loop list after add : [ankur, alex, brian, ankur, extra]
|
|
stream list after add : UnsupportedOperationException
|
|
|
|
== 4. A loop can update a counter; a lambda cannot ==
|
|
works, but it is a side effect: 2
|
|
the pipeline way (count) : 2
|
|
(a plain `int hits` would not compile: lambdas capture effectively-final variables only)
|