We all as Java programmers been through the situation where in we invoke a method to get some value and then instead of directly invoking some methods on the return value, we […]
Strategy Pattern using Lambda Expressions in Java 8
Strategy Pattern is one of the patterns from the Design Patterns : Elements of Reusable Object book. The intent of the strategy pattern as stated in the book is: Define a family […]
Creating Internal DSLs in Java, Java 8- Adopting Martin Fowler’s approach
Currently I am reading this wonderful book on DSLs- Domain Specific Languages by Martin Fowler. The buzz around the DSLs, around the languages which support creation of DSLs with ease, the use […]
Factory Method pattern in Java
In my previous post about the Template Method pattern, I showed how one can leverage lambda expression and default methods. In this post I will explore about factory method pattern and see […]
Train Wreck Pattern – A much improved implementation in Java 8

Venkat Subramaniam at a talk today mentioned about Cascade Method pattern or Train Wreck pattern which looks something like: someObject.method1().method2().method3().finalResult() Few might associate this with the builder pattern, but its not the […]
Converting a List into comma separated value string in Java
We all have at least once in our coding life time done this: “Concatenate the elements of a List into a comma separated string”. And each time we have spent some time […]
A simple application of Lambda Expressions in Java 8
I have been trying to fit in lambda expressions in the code I write and this simple example is a consequence of the same. For those totally unaware of Lambda Expressions in […]
Template Method Pattern- Using Lambda Expressions, Default Methods
Template Method pattern is one of the 23 design patterns explained in the famous Design Patterns book by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. The intent of this pattern […]
Arrays.sort versus Arrays.parallelSort

We all have used Arrays.sort to sort objects and primitive arrays. This API used merge sort OR Tim Sort underneath to sort the contents as shown below: [java] public static void sort(Object[] […]
Supplier interface in java.util.function package in Java 8
In my previous posts I wrote about Predicate, Consumer and Function interfaces. In this post I will write about Supplier interface with which I will conclude the description of the interfaces in […]