What Java language and Spring features introduced after Java 8 are most useful in production? As a Java8-in-production dev getting upto date, what key updates should I learn and practice?
Java 8 features Stream API, Lambda and concise code comparison with java 7 - Stack Overflow
Java 8 new features (streams, lambdas) examples.
How many of you are using Java 8 in your projects?
I've been using Retrolambda for ages, you don't need Jack if all you're using is lambdas.
More on reddit.comVideos
I’d love to hear from the community about the post-Java 8 features you use in production.
But He said if we are implementing Comparator interface with some class then I can reuse it while using Lambda expression I have to write logic again and again whenever I what to do sorting.
You just have to catch the lambda into a variable as done in the first example and use it everywhere you want. This argument is very common among 7 resisting devs, first tell him that you don't have to construct a class for a single instanciation; second that the comparator code is present at the right place, so that reading how the collection is sorted doesn't need to search for the definition of the sorting class; third that the compiler is best at optimizations when using lambdas...
For Stream API we can also sort elements, So why should we use Stream API of Java8 for sorting
Sorting is exactly one of the functionalities that are not good in streaming POV. It is given just not to break the stream : construct a stream, collect, sort, stream again, etc
I think the key here is not about implementing Comparator or using Lambda, both are ok. What's more important is the transition of our mindset from OOP in Java7 to Functional Programming in Java8. The key of functional programming is to treat functions as the first class citizens, meaning functions and data are of the same importance. It blurs boundaries between them, thus functions can be stored in variables and passed anywhere (pretty much like function pointer in C). Then you can use it anywhere and be free from the rigid Class-Object hierarchy.