An Introduction to Functional Programming with Java 8
Java 8 is perhaps one of the most exciting editions of the Java language in recent times. One of the headline features is support for functional programming which is the focus of this blog. The support...
View ArticleIntroduction to Functional Programming in Java 8 – Part Two
Welcome to Part Two! To begin this session, let’s start with a return to our HelloWorld example from the last article. public class HelloWorldConcise { private void doPrint(String str) {...
View ArticleRanges and Looping with IntStream
In the previous posts we looked at taking a container, getting it to stream its contents into a pipeline and looked at a few different operations on data in that pipeline (forEach, map, filter, peek)....
View ArticleGenerators with Java 8
Today we’ll look at creating generators. In simple terms, a generator is a function which returns the next value in a sequence. Unlike an iterator, it generates the next value when needed, rather than...
View ArticleFinite sequence generators in Java 8
… and introducing default methods. Last time we looked at generators, and more specifically those generating an infinite sequence. We saw that there were several ways to achieve this: The older Java 7...
View ArticleFinite Sequence Generators in Java 8 – Part 2
In the last couple of articles we looked at generators. First we looked at ways of generating an infinite sequence. In the second we saw a way of generating a finite sequence. Let’s look at a few more...
View ArticleOptional: Java 8’s way to deal with null
For those who have been programming Java or C/C++ for any period of time will know one of the most annoying things is trying to debug a crash due accessing a null object. While the concept of null is...
View ArticleCollectors Part 1 – Reductions and Short-Circuiting Operations
In the first couple of articles we looked at streams. We saw that we could take something simple such as a list of countries, filter or map their names and then print them via a foreach. We then looked...
View ArticleCollectors Part 2: Provided collectors and a Java 8 streams demonstration
Today we’re going to continue where the last article left off. In that one we looked at collectors, specifically reduction and short-circuiting operations. Today we’ll look at the collect function and...
View ArticleParallel Streams and Spliterators
Today we are going to look at one of the aspects where using streams is a real win – when we need to thread work. As well as parallel streams, we will also look at Spliterators which acts as the...
View Article