Java Bootcamp – Workbooks and Challenges
)}

Workbook 13.2

From the Java Bootcamp Resources, launch starter.

starter.png

Task 1

Considering that sort relies on a Comparator, sort the prices in descending order.

Functional InterfaceExample
Consumerx -> { code }
Predicatex -> { return boolean }
Functionx -> { return value }
BiConsumer(x, y) -> { code }
Comparator(x, y) -> { return int }
BinaryOperator(x, y) -> { return value (same type) }

Task 2

Use forEach to print each price in the sorted List.

Expected Output

Prices
------
111.99
88.99
77.99
55.99
55.99
33.99
11.49

Task 3

Sort the books List in ascending (alphabetical) order.

Task 4

Use forEach to print each book in the sorted List.

Library
--------
Moby-Dick
One Hundred Years of Solitude
Pride and Prejudice
The Alchemist
The Brothers Karamazov
The Catcher in the Rye
The Great Gatsby
The Lord of the Rings
The Picture of Dorian Gray
To Kill a Mockingbird

Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer

Feedback Summary
4.7
43 students
5

91%
4

2%
3

0%
2

0%
1

7%
Written Reviews
There are no written reviews yet.