Reduce nested loops with closures and functional programming

Today I was developing some code that combined information from 2 different arrays. The first array was a list of data-objects. Each data-object has a 'type' parameter. The second array was a list of 'types' and it function is to specify the order (sorting) and which data-object must be rendered. Initially I solved this with 2 nested foreach loops, which hurts the eyes and can be a performance killer when working with big data-structures. So in a code-review my collegue asked me to rewrite this.

I am getting excited about Drupal 8

Drupal 8 is better than Drupal 7. Data-modelling, performance, multi-language. It feels so much more robust this day. More functionality is in-core and fully tested.
In a conceptual way, Drupal 8 is not so different from Drupal 7. The Administration-UI’s are the same and you probably will also use the same modules for a project. Site builders will feel really comfortable.
All-in-all I am getting excited about Drupal 8!