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

command pattern class diagram

Command Pattern with Java examples

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