I have JUnit tests (which I cannot modify) and have to write a program in Java 8. The part of the tests that I'm interested in is:
Set<Customer> mexicans = shop.filter(Customer.class, c -> c.getCountry().equals("Mexico"));
Set<Product> goldenWaffles = shop.filter(Product.class, p -> p.getBrand().equals("Golden") && p.getName().contains("Waffles"));
So the second parameter of filter function is lambda expression, which I would take as parameter of type Predicate<Product> or Predicate<Customer> (am I right here?). The problem is: I need to be able to take them both and I don't know how to do it. Has it something to do with the first parameter?
Customercan't be a golden waffle, and aProductcan't be a Mexican; so what would it mean to apply both filters?