remove Java 8 functional foreach loop