Hi guys. This time I wanted to ask you about if currently developers are using most of the stuff from Java 8 like lambdas and streams. I was developing before (like almost 4 years ago) for a company and we didn't use even Java 8. So still I'm not developing again (I wanto to pass the ocp exam before) so I'd like to know for you all if in your projects you are using all of these "new" features.
For me it's being a bit hard to assimilate all of these things because it's like a change of paradigm but It's really interesting anyway.
Yes, I do. After passing my OCP exam on Java 8, I try to implement what I've learnt into my daily work. Then, I always ask myself one question during my development: If I implement this logic by Java stream, does it save obvious number of lines of code? If the answer is yes, I implement my logic by Java stream for sure.
Java stream helps me to achieve cleaner coding when manipulating elements in Java Collections and I love using it.
Just a caveat: fewer lines of code does not necessarily equate to cleaner code. Just remember that, please. Clean code is easy to understand and easy to maintain. If you can say something in one line of code instead of five lines and not sacrifice clarity of intent then, yes, do it. If the shorter code is more cryptic, however, seriously reconsider.
The good thing is that lambdas and streams and the abstractions that they offer can often result in code that is both shorter and more expressive of intent than the equivalent imperative style code.
The best ideas are the crazy ones. If you have a crazy idea and it works, it's really valuable.—Kent Beck