@Test void contains() { assertTrue(menu.contains((node) -> node.getLabel().equals("lbl"))); assertTrue(menu.contains((node) -> node.getLabel().equals("sub lbl"))); }
@Override public boolean contains(Predicate<MenuNode> predicate) { return predicate.test(this) || getItems().stream().anyMatch(it -> it.contains(predicate)); }
Menu implements MenuNode { @Override public boolean contains(Predicate<MenuNode> predicate) { return predicate.test(this) || getItems().stream().anyMatch(it -> it.contains(predicate)); } }
Menu implements MenuNode { @Override public boolean contains(Predicate<MenuNode> predicate) { return predicate.test(this) || getItems().stream().anyMatch(it -> it.contains(predicate)); }  }
Menu implements MenuNode { @Override public boolean contains(Predicate<MenuNode> predicate) { return predicate.test(this) || getItems().stream().anyMatch(it -> it.contains(predicate)); }  abstract List<MenuNode> getItems(); @Override Optional<MenuNode> filter(Predicate<MenuNode> predicate); @Override boolean isMenu(); @Override Optional<List<String>> getPath(String id); @Override boolean contains(Predicate<MenuNode> predicate); Optional<MenuItem> firstItem(); Optional<Menu> findMenu(String menuId); static Menu create(String id, String label, List<MenuNode> items); }
Menu implements MenuNode { @Override public boolean contains(Predicate<MenuNode> predicate) { return predicate.test(this) || getItems().stream().anyMatch(it -> it.contains(predicate)); }  abstract List<MenuNode> getItems(); @Override Optional<MenuNode> filter(Predicate<MenuNode> predicate); @Override boolean isMenu(); @Override Optional<List<String>> getPath(String id); @Override boolean contains(Predicate<MenuNode> predicate); Optional<MenuItem> firstItem(); Optional<Menu> findMenu(String menuId); static Menu create(String id, String label, List<MenuNode> items);  }