Arrays very common and useful data structure to save collections but they have a small catch in…
Thank you! ^^
TL;DR: As long as the code is more readable there is no problem in using
foreach, specially when few mutations are happening, it is always better to have a code that is stupid easy to understand than to have a unnecessary abstraction just because “I want to force everything to be functional”.