Java 8 flatMap example
This article explains the Java 8 Stream.flatMap and how to use it. In Java 8, we can use the flatMap to convert the above 2 levels Stream into one Stream…
Favourite tutorials for developers
This article explains the Java 8 Stream.flatMap and how to use it. In Java 8, we can use the flatMap to convert the above 2 levels Stream into one Stream…
Few Java examples to show you how to filter a Map with Java 8 stream API. With Java 8, you can convert a Map.entrySet() into a stream, follow by a…
In Java 8, stream().map() lets you convert an object to something else. Review the following examples : convert a list of Strings to upper case, get all the name values…
Here are a few Java examples of converting a String to the new Java 8 Date API – java.time.LocalDate. The key is understand the DateTimeFormatter patterns. If the date is…
Few examples to show you how to format java.time.LocalDateTime in Java 8. To format a LocalDateTime object, uses DateTimeFormatter. Also we can convert a String back to LocalDateTime.
In Java 8, BiConsumer is a functional interface – BiConsumer<T, U>; it takes two arguments and returns nothing. Further Reading – Java 8 Consumer Examples 1. BiConsumer JavaBiConsumer1.java Output 2.…
In Java 8, Supplier is a functional interface; it takes no arguments and returns a result. We can use Supplier to return some values or to build factory method in…
In Java 8, Function is a functional interface; it takes an argument (object of type T) and returns an object (object of type R). The argument and output can be…
In Java 8, BiFunction is a functional interface - BiFunction; it takes two arguments and returns an object. T – Type of the first argument to the function. U –…
In Java 8, the double colon (::) operator is called method references. There are four kinds of method references: 1 - Reference to a static method ClassName::staticMethodName, 2 - Reference…