T - type of elements.public class TreeWithParent<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TreeWithParent.Node<T>
Tree node.
|
| Constructor and Description |
|---|
TreeWithParent(TreeWithParent<T> parent)
Constructor with parent which can be null for the root node.
|
| Modifier and Type | Method and Description |
|---|---|
TreeWithParent.Node<T> |
add(T element)
Append a new node with the given element.
|
TreeWithParent.Node<T> |
get(int index)
Get the node at the given index.
|
TreeWithParent.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<TreeWithParent.Node<T>> |
getNodes() |
TreeWithParent<T> |
getParent() |
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 TreeWithParent(TreeWithParent<T> parent)
public TreeWithParent<T> getParent()
public TreeWithParent.Node<T> add(T element)
public boolean remove(T element)
public boolean removeInstance(T element)
public TreeWithParent.Node<T> get(T element)
public TreeWithParent.Node<T> get(int index)
public List<TreeWithParent.Node<T>> getNodes()
public int size()
Copyright © 2017. All rights reserved.