public class AvlTree<T> extends AbstractCollection<T> implements Set <T>, SortedSet <T>, List <T>, BinaryTree <T>
| Constructor and Description |
|---|
AvlTree()
|
AvlTree(Comparator
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index, T element)
|
boolean |
add(T element)
|
boolean |
addAll(int index, Collection
|
boolean |
checkBalanced()
Check whether the tree is balanced.
|
void |
clear()
Removes all elements from the tree.
|
Comparator |
comparator()
|
boolean |
contains(Object
|
boolean |
containsElement(T e)
Test whether this tree stores the specified element.
|
List |
elementsAsList()
Get all elements stored in this tree as a list.
|
T |
findMax()
Find the biggest element stored in this tree.
|
T |
findMin()
Find the smallest element stored in this tree.
|
TreeNode |
findNode(T e)
|
T |
first()
|
T |
get(int index)
|
BinaryTreeNode |
getBinaryRoot()
|
T |
getElement(int index)
Get the element at position
index
|
int |
getHeight()
Get the height of the tree.
|
TreeNode |
getRoot()
|
SortedSet |
headSet(T toElement)
|
int |
indexOf(Object
|
boolean |
insertElement(T e)
Insert the specified element into the tree.
|
boolean |
isEmpty()
Returns
true if this tree contains no elements.
|
Iterator |
iterator()
|
T |
last()
|
int |
lastIndexOf(Object
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
T |
remove(int index)
|
boolean |
remove(Object
|
boolean |
removeElement(T e)
Remove the specified element from the tree if present.
|
T |
set(int index, T element)
|
int |
size()
Get the number of elements stored in this tree.
|
List |
subList(int fromIndex, int toIndex)
|
SortedSet |
subSet(T fromElement, T toElement)
|
SortedSet |
tailSet(T fromElement)
|
String |
toFoldedString()
Create a printable representation of the tree.
|
addAll, containsAll, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitspliteratoraddAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayparallelStream, removeIf, streamaddAll, containsAll, equals, hashCode, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArraypublic AvlTree()
public AvlTree(Comparator<? super T> comparator)
public boolean insertElement(T e)
public boolean removeElement(T e)
public void clear()
public boolean isEmpty()
public int getHeight()
public int size()
public boolean containsElement(T e)
public T getElement(int index)
public T findMin()
public T findMax()
public List<T> elementsAsList()
public StringtoFoldedString()
public boolean checkBalanced()
public boolean add(T element)
public boolean contains(Objectobject)
public boolean remove(Objectobject)
public Comparator<? super T> comparator()
public T first()
public T last()
public void add(int index,
T element)public boolean addAll(int index,
Collection<? extends T> c) public T get(int index)
public T remove(int index)
public int indexOf(Objecto)
public int lastIndexOf(Objecto)
public ListIterator<T> listIterator()
public ListIterator<T> listIterator(int index)
public BinaryTreeNode<T> getBinaryRoot()