why would you want to use an extra array and iterate over it. You can use collect and return from single line without return statement.