Home » Tag Archives: Lambdas (page 6)

Tag Archives: Lambdas

Lambdas for Fluent and Stable APIs

A few weeks ago I wrote an introduction on Java 8 lambdas. In this introduction I explained what a lambda is and how to use them in conjunction with the new Stream API, that is also introduced in Java 8. The Stream API provides a more functional interface to collections. This interface heavily depends on lambdas. But there’s much more ...

Read More »

Introduction to Java lambdas

The main theme of Java 8 is lambdas. I have noticed that for many Java programmers lambdas are pretty tough material. So let’s try to get a basic understanding of them. First of all, what exactly is a lambda? A lambda is an anonymous function that is, unlike a regular function, not bound to an identifier (i.e. it has no ...

Read More »

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 of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. In this post I would like to give ...

Read More »

Lambdas: coming to a Java 8 near you!

What are Lambdas? A lambda expression is a type of anonymous function, that can be written inline within a method and used wherever expressions are used. Sometimes you might find them referred to as closures, though there are some caveats to that reference that I explain below. Like a normal Java method it has parameters and a body that can ...

Read More »

Java 8 lambda walkthrough

For work I have made a presentation about Java 8 project lambda and of course also some simple code illustrating some of the points. The overall reasons for Java 8 are: More concise code (for classes that have just one method & collections). “We want the reader of the code to have to wade through as little syntax as possible ...

Read More »

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 is stated as: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. TemplateMethod lets subclasses redefine certain steps of an algorithm without changing ...

Read More »

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 Java, I would recommend them to read this first before getting into this post. Ok, now that you are familiar with Lambda Expressions (after reading the introductory post), ...

Read More »

Java 8 Lambdas – The missing link to moving away from Java

I learnt functional programming, but then I decided I liked imperative programming better so I switched back. — Nobody, ever Moving from imperative programming to functional programming is a very common thing to do today. Blog posts on the internet abound with testimonies about it. Everything I’ve read and every person I’ve talked to, including myself, has the same story. ...

Read More »