### Question:
LinkedTree implements MutableTree<T> { @Override public void removeNodeIf(@Nonnull JPredicate<? super TreeNode<T>> filter) { Collections.removeIf(this.iterator(), filter); } @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = {"NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"}) private  LinkedTree(); @Nonnull @Override MutableTreeNode<T> getRoot(); @Override int getSize(); @Override void removeNodeIf(@Nonnull JPredicate<? super TreeNode<T>> filter); @Nonnull @Override List<? extends MutableTreeNode<T>> getAllNodes(); @Nonnull @Override DepthTreeIterator<T> iterator(); @Nonnull @Override DepthTreeIterator<T> getIterator(); @Override String toString();  }### Answer:
@Test public void testRemoveNodeIf() throws Exception { MutableTree<Integer> tree = createMockTree(); tree.removeNodeIf(new JPredicate<TreeNode<Integer>>() { @Override public boolean apply(@Nullable TreeNode<Integer> input) { return input.getValue() % 2 == 0; } }); Assert.assertEquals(3, tree.getSize()); for (TreeNode<Integer> node : tree) { Assert.assertTrue(node.getValue() % 2 != 0); } tree = createMockTree(); tree.removeNodeIf(new JPredicate<TreeNode<Integer>>() { @Override public boolean apply(@Nullable TreeNode<Integer> input) { return true; } }); Assert.assertEquals(1, tree.getSize()); tree = createMockTree(); tree.removeNodeIf(new JPredicate<TreeNode<Integer>>() { @Override public boolean apply(@Nullable TreeNode<Integer> input) { return input.getValue() % 2 != 0; } }); Assert.assertEquals(5, tree.getSize()); for (TreeNode<Integer> node : tree) { if (node != tree.getRoot()) { Assert.assertTrue(node.getValue() % 2 == 0); } } }