Java 8 flatMap examples

We would be looking at flatMap method in Java 8 streams and Optional. In our last tutorial we looked at map method in Java 8 stream example. Let us start with the examples 1. Flatten a List<List<String>> to List<String> using flatMap Here we have two lists, a list of front-end languages and a list of … Read more

Java 8 map method Examples

Java 8 map method example

In Java 8 streams map() method is one of the most important and the widely used methods of streams. In this tutorial, we would be looking at various ways we can use map method. These examples can help you understand the usage of Java 8 stream map() method. The javadocs describes the example:() method as: … Read more

Command Pattern with Java examples

command pattern class diagram

This pattern falls under the behavioral design pattern category. In this pattern, the information inside one request is mapped to a single object and then that object is used as required. It encapsulates a whole request as an object called ‘Command’. The ‘Command’ can be identified as a materialized method call. That object often contains … Read more