AvlTreeSet<V> class Null safety

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
read-onlyoverride
hashCode int
The hash code for this object.
read-onlyinherited
isEmpty bool
Whether this collection has no elements.
read-onlyinherited
isNotEmpty bool
Whether this collection has at least one element.
read-onlyinherited
iterator BidirectionalIterator<V>
See IterableBase.iterator
read-onlyoverride
last → V
See IterableBase.last
read-onlyoverride
length int
Returns the number of elements in this.
read-onlyoverride
reverseIterator BidirectionalIterator<V>
See TreeSet.reverseIterator
read-onlyoverride
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
single → V
Checks that this iterable has only one element, and returns that element.
read-onlyinherited

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
cast<T>() AvlTreeSet<T>
Provides 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
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
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 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}) BidirectionalIterator<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
Returns 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 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
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
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
union(Set<V> other) Set<V>
See Set.union
override
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 ==(Object other) bool
The equality operator.
inherited