Question: public interface UnaryPredicate { public boolean test(T obj); } This is a functional interface and can therefore be used as the assignment target for a
public interface UnaryPredicate{ public boolean test(T obj); } This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. Q2: Write a class Primepredicate to implement the UnaryPredicate interface where T is Integer class. In the class, override the test method returns true if the argument is a palindrome number (for example: 101, 53035) Q3: Write a generic method to count the number of elements in a collection that have a specific property (for example, odd integers, prime numbers, palindromes). Q4: Test your generic method in a demo program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
