@Test public void detach() { final TreeNode<Integer> tree = TreeNode.of(0) .attach(TreeNode.of(1) .attach(TreeNode.of(3)) .attach(TreeNode.of(4))) .attach(TreeNode.of(2) .attach(TreeNode.of(5)) .attach(TreeNode.of(6))); Assert.assertEquals(tree.size(), 7); final TreeNode<Integer> detached = tree.childAt(1).detach(); Assert.assertEquals(tree.size(), 4); Assert.assertEquals(detached.size(), 3); }
public TreeNode<T> detach() { if (_parent != null) { _parent.remove(this); } return this; }
TreeNode implements
		Tree<T, TreeNode<T>>,
		Iterable<TreeNode<T>>,
		Copyable<TreeNode<T>>,
		Serializable { public TreeNode<T> detach() { if (_parent != null) { _parent.remove(this); } return this; } }
TreeNode implements
		Tree<T, TreeNode<T>>,
		Iterable<TreeNode<T>>,
		Copyable<TreeNode<T>>,
		Serializable { public TreeNode<T> detach() { if (_parent != null) { _parent.remove(this); } return this; } private  TreeNode(final T value); }
TreeNode implements
		Tree<T, TreeNode<T>>,
		Iterable<TreeNode<T>>,
		Copyable<TreeNode<T>>,
		Serializable { public TreeNode<T> detach() { if (_parent != null) { _parent.remove(this); } return this; } private  TreeNode(final T value); void value(final T value); @Override T value(); @Override Optional<TreeNode<T>> parent(); @Override TreeNode<T> childAt(final int index); @Override int childCount(); @Override Iterator<TreeNode<T>> childIterator(); @Override Stream<TreeNode<T>> childStream(); TreeNode<T> insert(final int index, final TreeNode<T> child); TreeNode<T> replace(final int index, final TreeNode<T> child); TreeNode<T> remove(final int index); boolean removeAtPath(final Path path); boolean replaceAtPath(final Path path, final TreeNode<T> child); TreeNode<T> detach(); void remove(final Tree<?, ?> child); void removeAllChildren(); TreeNode<T> attach(final TreeNode<T> child); @SafeVarargs final TreeNode<T> attach(final T... children); TreeNode<T> attach(final T child); @Override TreeNode<T> copy(); TreeNode<B> map(final Function<? super T, ? extends B> mapper); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); static TreeNode<T> of(); static TreeNode<T> of(final T value); static TreeNode<B> ofTree(
		final Tree<? extends T, ?> tree,
		final Function<? super T, ? extends B> mapper
	); static TreeNode<T> ofTree(final Tree<? extends T, ?> tree); static TreeNode<String> parse(final String tree); static TreeNode<B> parse(
		final String tree,
		final Function<? super String, ? extends B> mapper
	); }
TreeNode implements
		Tree<T, TreeNode<T>>,
		Iterable<TreeNode<T>>,
		Copyable<TreeNode<T>>,
		Serializable { public TreeNode<T> detach() { if (_parent != null) { _parent.remove(this); } return this; } private  TreeNode(final T value); void value(final T value); @Override T value(); @Override Optional<TreeNode<T>> parent(); @Override TreeNode<T> childAt(final int index); @Override int childCount(); @Override Iterator<TreeNode<T>> childIterator(); @Override Stream<TreeNode<T>> childStream(); TreeNode<T> insert(final int index, final TreeNode<T> child); TreeNode<T> replace(final int index, final TreeNode<T> child); TreeNode<T> remove(final int index); boolean removeAtPath(final Path path); boolean replaceAtPath(final Path path, final TreeNode<T> child); TreeNode<T> detach(); void remove(final Tree<?, ?> child); void removeAllChildren(); TreeNode<T> attach(final TreeNode<T> child); @SafeVarargs final TreeNode<T> attach(final T... children); TreeNode<T> attach(final T child); @Override TreeNode<T> copy(); TreeNode<B> map(final Function<? super T, ? extends B> mapper); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); static TreeNode<T> of(); static TreeNode<T> of(final T value); static TreeNode<B> ofTree(
		final Tree<? extends T, ?> tree,
		final Function<? super T, ? extends B> mapper
	); static TreeNode<T> ofTree(final Tree<? extends T, ?> tree); static TreeNode<String> parse(final String tree); static TreeNode<B> parse(
		final String tree,
		final Function<? super String, ? extends B> mapper
	);  }