Practical Work 04-1: Lambdas
Intro
The goal of this work is to write lambda expressions in order to get familiar with them.
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. -
Then import the project inside your workplace (you may need to create an empty project in Eclipse for that, then import->existing files)
Everything is in the code!
- By reading the code of the provided project, you'll find the
FIXME
comments that will guide you to realize this practical work.
Hint
There is a preferred way to go through the methods:
- begin with
getTopTenItems()
, - go then to
filterByGenre() & filterByBorrower()
, - you can now safely have a look at
searchByTitle()
- proceed with
printList()
, and maybe have a look atprintSortedList()
while you're at it - you are now ready for
!#java CulturalItem.getAverageRating()
, as it is a little tedious , but should be easy by now :)
When you want to test your work, just remember that the output of the main()
method in your console should not change.