AvlTreeSet<V> class

AVL implementation of a self-balancing binary tree. Optimized for lookup operations.

Notes: Adapted from "Introduction to Algorithms", second edition, by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein. chapter 13.2

Inheritance

Constructors

AvlTreeSet({Comparator<V> comparator})

Properties

first → V
See IterableBase.first
read-only, override
iterator BidirectionalIterator<V>
See IterableBase.iterator
read-only, override
last → V
See IterableBase.last
read-only, override
length int
Returns the number of elements in this. [...]
read-only, override
reverseIterator BidirectionalIterator<V>
See TreeSet.reverseIterator
read-only, override
comparator Comparator<V>
final, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
isEmpty bool
Returns true if there are no elements in this collection. [...]
read-only, inherited
isNotEmpty bool
Returns true if there is at least one element in this collection. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
single → V
Checks that this iterable has only one element, and returns that element. [...]
read-only, inherited

Methods

add(V element) bool
Add the element to the tree.
override
addAll(Iterable<V> items) bool
Adds all elements to this Set. [...]
override
cast<T>() AvlTreeSet<T>
Provides a view of this iterable as an iterable of R instances. [...]
override
clear() → void
Removes all elements in the set.
override
contains(Object object) bool
See IterableBase.contains
override
containsAll(Iterable<Object> items) bool
Returns whether this Set contains all the elements of other.
override
difference(Set<Object> other) Set<V>
See Set.difference
override
fromIterator(V anchor, {bool reversed: false, bool inclusive: true}) BidirectionalIterator<V>
See TreeSet.fromIterator
override
getNode(V object) AvlNode<V>
@visibleForTesting
intersection(Set<Object> other) Set<V>
See Set.intersection
override
lookup(Object element) → V
See Set.lookup
override
nearest(V object, {TreeSearch nearestOption: TreeSearch.NEAREST}) → V
Search the tree for the matching object or the nearestOption if missing. See TreeSearch.
override
remove(Object item) bool
Removes value from the set. Returns true if value was in the set. Returns false otherwise. The method has no effect if value value was not in the set.
override
removeAll(Iterable items) → void
See Set.removeAll
override
removeWhere(bool test(V element)) → void
See Set.removeWhere
override
retainAll(Iterable<Object> elements) → void
See Set.retainAll
override
retainWhere(bool test(V element)) → void
See Set.retainWhere
override
union(Set<V> other) Set<V>
See Set.union
override
any(bool test(V element)) bool
Checks whether any element of this iterable satisfies test. [...]
inherited
elementAt(int index) → V
Returns the indexth element. [...]
inherited
every(bool test(V element)) bool
Checks whether every element of this iterable satisfies test. [...]
inherited
expand<T>(Iterable<T> f(V element)) Iterable<T>
Expands each element of this Iterable into zero or more elements. [...]
inherited
firstWhere(bool test(V element), {V orElse()}) → V
Returns the first element that satisfies the given predicate test. [...]
inherited
fold<T>(T initialValue, T combine(T previousValue, V element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value [...]
inherited
followedBy(Iterable<V> other) Iterable<V>
Returns the lazy concatentation of this iterable and other. [...]
inherited
forEach(void f(V element)) → void
Applies the function f to each element of this collection in iteration order.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings. [...]
inherited
lastWhere(bool test(V element), {V orElse()}) → V
Returns the last element that satisfies the given predicate test. [...]
inherited
map<T>(T f(V e)) Iterable<T>
Returns a new lazy Iterable with elements that are created by calling f on each element of this Iterable in iteration order. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
reduce(V combine(V value, V element)) → V
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function. [...]
inherited
singleWhere(bool test(V element), {V orElse()}) → V
Returns the single element that satisfies test. [...]
inherited
skip(int count) Iterable<V>
Returns an Iterable that provides all but the first count elements. [...]
inherited
skipWhile(bool test(V value)) Iterable<V>
Returns an Iterable that skips leading elements while test is satisfied. [...]
inherited
take(int count) Iterable<V>
Returns a lazy iterable of the count first elements of this iterable. [...]
inherited
takeWhile(bool test(V value)) Iterable<V>
Returns a lazy iterable of the leading elements satisfying test. [...]
inherited
toList({bool growable: true}) List<V>
Creates a List containing the elements of this Iterable. [...]
inherited
toSet() Set<V>
Creates a Set containing the same elements as this iterable. [...]
inherited
toString() String
Returns a string representation of (some of) the elements of this. [...]
inherited
where(bool test(V element)) Iterable<V>
Returns a new lazy Iterable with all elements that satisfy the predicate test. [...]
inherited
whereType<T>() Iterable<T>
Returns a new lazy Iterable with all elements that have type T. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited