יום שני, 13 באפריל 2015

Java 8: No more loops

As I've written before, the new functional features in Java 8 is a game changer. It’s a new world for the Java developer and it's time to adjust to it.
In this post we’ll look at some alternative solutions to the traditional loop. The great thing about the new functional features in Java 8, is that it allows us to say what we want to be done instead of saying how to do it. This is where loops fall short. Sure loops are flexible, but this flexibility doesn’t come without a price. A return, break or continue dramatically changes how the loop will act, forcing us not only to understand what the code is trying to achieve, but also understand how the loop works.