In order to explore some of the goodies of Java Functional Programming in a test-driven fashion, we are going to set up a Java project with JUnit and AssertJ frameworks. The last one includes quite a few convenient methods for Optional.Â
Let's start a new Gradle project. This is how build.gradle looks:
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.9.0'
}
In the following sections, we are going to explore some of the utilities and classes included in Java 8 that enhance the experience of programming. Most of them are not only for functional programming and can be used even in imperative...