Archives de catégorie : lambda

Java 8 flatMap or how to « flat mapped » a stream to another stream

Stream.map() and Stream.flatMap() methods are very close methods. These map a stream to another one by applying the function passed as argument for each element of the initial stream. But these are not applied in the same context. map() expects any … Continuer la lecture

Publié dans flatmap, java, java8, lambda | Laisser un commentaire

Java 8 Method references or how to shorten lambdas that invoke just one method

There are 3 categories of lambda expression that we could convert to method references. All of these consist of a single method invocation. 1) Invoking an instance method on the first argument of the lambda 2) Invoking a static method on … Continuer la lecture

Publié dans java, java 8, java8, lambda | Laisser un commentaire

Java 8 Lambda expressions or how to write a better quality code

Lambda that relies mainly on the Java 8 functional interface concept has two faces :– it is really necessary to use streams that were also introduced in Java 8– beyond this use with streams, it is also a excellent language … Continuer la lecture

Publié dans anonymous class, java, java 8, java8, lambda | Laisser un commentaire