명령형 loop와 선언형 pipeline

control flow를 직접 관리하는 방식과 변환 관계를 선언하는 방식을 비교한다.

Loop

if·continue·accumulator로 순회를 제어한다

explicit how

Stream

filter·map·sum으로 결과 관계를 나타낸다

declarative what
공통 원칙외부 상태 대신 local result를 반환하면 둘 다 예측 가능하다

핵심: Stream callback에서 외부 list를 변경하면 control flow만 숨은 mutable code가 된다.