Question: Declare an interface Filter as follows: public interface Filter { boolean accept(Object x); } Add a Filter parameter to the average method of Section 9.6.
Declare an interface Filter as follows:
public interface Filter { boolean accept(Object x); }
Add a Filter parameter to the average method of Section 9.6. Only objects that the filter accepts should be processed. Demonstrate your modification by processing a collection of bank accounts, filtering out all accounts with balances less than $1,000.
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
BalanceFilterjava Filter out balance less than 1000 public class BalanceFilter implements Filter Acc... View full answer
Get step-by-step solutions from verified subject matter experts
