T-Systems interview question

Coding question on java stream