T - type of elements.public class Tree<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Tree.Node<T>
Tree node.
|
static class |
Tree.WithParent<T>
Tree with a reference to the parent.
|
| Constructor and Description |
|---|
Tree() |
| Modifier and Type | Method and Description |
|---|---|
Tree.Node<T> |
add(T element)
Append a new node with the given element.
|
Tree.Node<T> |
get(int index)
Get the node at the given index.
|
Tree.Node<T> |
get(T element)
Get the node containing the given element.
|
List<T> |
getElements()
Return a list of elements contained in the nodes.
|
List<Tree.Node<T>> |
getNodes() |
protected Tree<T> |
newSubTree() |
boolean |
remove(T element)
Remove the first occurrence of the given element.
|
boolean |
removeInstance(T element)
Remove the first occurrence of the given instance.
|
int |
size()
Return the number of elements.
|
public boolean remove(T element)
public boolean removeInstance(T element)
public int size()
Copyright © 2019. All rights reserved.