Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
First, what I can see, is memory usage, because a Stream is an Object by himself and it consumes more memory for links, metadata, etc than a single int variable in the solution below. Then filter statement use lambda which is Anonymous class instead of plain if statement. Not sure about performance, because I don't know a lot about how stream executes, but it can be easily tested. In another hand, stream can be executed parallel (check Arrays.parallelStream() or Stream.parallelStream()) what is easier to use than write parallel code by yourself.
In conclusion, I will say that for this kind of tasks it's better to use default loops and ifs, because task is pretty simple and solution will look clean and easy to read. But when you have a lot of intermediate operations with objects streams will look much sweeter.