Skip to content

Practical Work 04-2: Stream API

Intro


The goal of this work is to use lambda expressions in streams on a small set of data in order to discover how powerful they are.

Prerequisites


Warning

Lambdas & streams are a Java 8 feature; you need a JDK >8 installed.

Instructions


Installation of the project

  • The first step is to download the starting project code.zip and to extract it inside your workplace.

  • Extract the downloaded file on your disk and import the project inside your IDE, as a maven project.

Hint

In Eclipse, use the File -> Import wizard, and choose existing maven project as type.

Warning

If you don't import the project as a maven project, don't expect it to work, as nothing will download the dependencies magically !

Everything is in the code!

  • By reading the code of the provided project, you'll find the TODO comments that will guide you to realize this practical.

Hint

Look at DemographicCalculator

When you want to test your work, some methods in Application.java are provided, just launch them to control your progression.