Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Progress Monitoring Data Tracking Organizer

Authors: Teacher'S Aid Publications

1st Edition

B0B7QCNRJ1

More Books

Students also viewed these Databases questions