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
Available extensions

Constructors

AvlTreeSet({Comparator<V> comparator = _defaultCompare})

Properties

comparator Comparator<V>
finalinherited
first → V
See IterableBase.first
no setteroverride
firstOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The first element of this iterator, or null if the iterable is empty.
no setter
hashCode int
The hash code for this object.
no setterinherited
indexed Iterable<(int, T)>

Available on Iterable<T>, provided by the IterableExtensions extension

Pairs of elements of the indices and elements of this iterable.
no setter
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator TreeIterator<V>
See IterableBase.iterator
no setteroverride
last → V
See IterableBase.last
no setteroverride
lastOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The last element of this iterable, or null if the iterable is empty.
no setter
length int
The number of elements in this Iterable.
no setteroverride
nonNulls Iterable<T>

Available on Iterable<T?>, provided by the NullableIterableExtensions extension

The non-null elements of this iterable.
no setter
reverseIterator TreeIterator<V>
See TreeSet.reverseIterator
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single → V
Checks that this iterable has only one element, and returns that element.
no setterinherited
singleOrNull → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The single element of this iterator, or null.
no setter
wait Future<List<T>>

Available on Iterable<Future<T>>, provided by the FutureIterable extension

Waits for futures in parallel.
no setter

Methods

add(V element) bool
Add the element to the tree.
override
addAll(Iterable<V> items) bool
Adds all elements to this set.
override
any(bool test(V element)) bool
Checks whether any element of this iterable satisfies test.
inherited
asNameMap() Map<String, T>

Available on Iterable<T>, provided by the EnumByName extension

Creates a map from the names of enum values to the values.
byName(String name) → T

Available on Iterable<T>, provided by the EnumByName extension

Finds the enum value in this list with name name.
cast<T>() AvlTreeSet<T>
A view of this iterable as an iterable of R instances.
override
clear() → void
Removes all elements from the set.
override
contains(Object? object) bool
See IterableBase.contains
override
containsAll(Iterable<Object?> items) bool
Whether this set contains all the elements of other.
override
difference(Set<Object?> other) Set<V>
See Set.difference
override
elementAt(int index) → V
Returns the indexth element.
inherited
elementAtOrNull(int index) → T?

Available on Iterable<T>, provided by the IterableExtensions extension

The element at position index of this iterable, or null.
every(bool test(V element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(V element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(V element), {V orElse()?}) → V
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>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(V element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
fromIterator(V anchor, {bool reversed = false, bool inclusive = true}) TreeIterator<V>
See TreeSet.fromIterator
override
intersection(Set<Object?> other) Set<V>
See Set.intersection
override
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(V element), {V orElse()?}) → V
The last element that satisfies the given predicate test.
inherited
lookup(Object? element) → V?
See Set.lookup
override
map<T>(T toElement(V e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
nearest(V object, {TreeSearch nearestOption = TreeSearch.NEAREST}) → V
Search the tree for the matching object or the nearestOption if missing. See TreeSearch.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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
remove(Object? item) bool
Removes value from 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
singleWhere(bool test(V element), {V orElse()?}) → V
The single element that satisfies test.
inherited
skip(int count) Iterable<V>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(V value)) Iterable<V>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<V>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(V value)) Iterable<V>
Creates 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
union(Set<V> other) Set<V>
See Set.union
override
where(bool test(V element)) Iterable<V>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited