/** * Returns the set of dishes of specific type, that contain filter in their name or name of any * ingredient. */ public Set<Dish> filterDishesOfType(int type, String filter) { Set<Dish> result = new HashSet<Dish>(); for (Dish d : dishes) { if (d.getType() == type && d.contains(filter)) { result.add(d); } } return result; }