This exercise asks you to write a generic countMatches method. Your method will take two parameters. The
Fantastic news! We've Found the answer you've been seeking!
Question:
This exercise asks you to write a generic countMatches method. Your method will take two parameters. The first parameter is an array of int. The second parameter is a function object that returns a Boolean.
a. Give a declaration for an interface that expresses the requisite function object.
b. countMatches returns the number of array items for which the function object returns true. Implement countMatches.
c. Test countMatches by writing a function object. EqualsZero that implements your interface to accept one parameter and returns true if the parameter is equal to zero. Use an EqualsZero function object to test countMatches.
Related Book For
Fundamentals of Database Systems
ISBN: 978-0136086208
6th edition
Authors: Ramez Elmasri, Shamkant Navathe
Posted Date: