Using iterators for trivial findFirst and toList cases uses less CPU and memory (in these cases, not while costing readability) Here is an icicle graph example of the CPU usage before Spring Optimize some iterations in BodyExtractor and BodyInserter and here it is after: Spring Optimize some iterations in BodyExtractor and BodyInserter There was about a 10-15% overhead with the streams usage, which we can save on by doing this.

Comment From: yuzawa-san

@simonbasle updated with intermediate variable.

https://github.com/spring-projects/spring-framework/pull/29972 also gets around another (I would say more expensive) streams usage in ReadOnlyHttpHeaders. https://github.com/spring-projects/spring-framework/blob/4e896c8125c957ffa63238d10444f76d9913b549/spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java#L150-L156 I left this one there because that PR avoids that entrySet and also I have been working on a branch where I got ReadOnlyHttpHeaders to use CollectionUtils.unmodifiableMultiValueMap internally.