It can simplify this way

Comment From: sbrannen

Thanks for the PR.

The proposal is certainly more succinct; however, we generally avoid the use of the Stream API in potential hot spots within the core and instead favor plain-old iterative loops.

In light of that, I am closing this PR.