Code example 22-1
import java.util.List;
import java.util.ArrayList;
public class ProductsApp {
public static void main(String[] args) {
List products = new ArrayList<>();
products.add(new Product("java", "Murach's Java Programming", 57.50, 5000));
products.add(new Product("cshp", "Murach's C#", 57.50, 2451));
products.add(new Product("mysql", "Murach's MySQL", 57.50, 473));
// call the filterProducts() method
}
public static List filterProducts(List products, TestProduct condition) {
List filteredProducts = new ArrayList<>();
for (Product p : products) {
// test the product and add to the list if it meets the condition
}
return filteredProducts;
}
}
(Refer to code example 22-1) Given the declaration for the TestProduct() interface that follows, which statement would you use to test the condition specified by the lambda expression that's passed to the filterProducts() method?
public interface TestProduct {
boolean test(Product p);
}