Question
I have to write the following method: public boolean removeIf(Predicate filter) - Removes all of the elements of this collection that satisfy the given predicate.
I have to write the following method:
public boolean removeIf(Predicate
* Use the removeIf method and a lambda expression to remove Person
* objects whos age is less than 30
*/
System.out.println(" Display Person list after remove age < 30: ");
for (Person p : arrP) {
System.out.println(p);
}
MyCollection
tmpP.add(new Person("Pilar", "Ess", 34));
tmpP.add(new Person("Jill", "Z", 30));
arrP.retainAll(tmpP);
System.out.println(" Display Person list after retainAll: ");
for (Person p : arrP) {
System.out.println(p);
I need this method to be added to following MyCollection interface:
public interface MyCollection
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started