Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
22.4. Built-in Functional Interfaces (java.util.function)
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
5 cards from this lesson. Good the night before a test.
Try these first
- 1.
Define what a Predicate
does. Hint
Think of it as a check or condition.
- 2.
What is the purpose of a Supplier
? Hint
Consider it as a source of values.
- 3.
What is a Predicate
? - A function that returns an integer
- A function that returns a boolean
- A function that takes no arguments
Hint
Think about its main purpose in logic.
- 4.
True or False: A Supplier
requires input to produce a value. - True
- False
Hint
Consider how it generates value.
- 5.
Write a series of lambda expressions that demonstrate the use of Predicate, Function, and Consumer on a list of Strings.
Hint
Consider how you can leverage all interfaces in a single operation.
- 6.
Design a BinaryOperator that combines two products based on price, sorting them and returning the more expensive one.
Hint
Consider the comparison logic that determines which product is more expensive.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting