Treap<T>
extension type
A persistent treap implementation using immutable nodes.
Provides efficient insertion, deletion, and lookup operations (O(log N)).
Constructors
Properties
-
base
→ TreapBase<
T, ImmutableNode< T> > -
final
-
compare
→ Comparator<
T> -
The Comparator used to determine element order.
finalinherited
- first → T
-
The first item in the sorted sequence.
no setterinherited
- firstOrDefault → T?
-
The first item in the sorted sequence, or
nullif this treap is empty.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this treap is empty.
no setterinherited
- last → T
-
The last item in the sorted sequence.
no setterinherited
- lastOrDefault → T?
-
The last item in the sorted sequence, or
nullif this treap is empty.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
The number of items in this treap.
no setterinherited
-
values
→ Iterable<
T> -
An Iterable of the items in this treap in ascending order according to compare.
no setterinherited
Methods
-
add(
T item) → Treap< T> -
Adds an
itemto this treap.override -
addAll(
Iterable< T> items) → Treap<T> -
Adds all
itemsto this treap.override -
addOrUpdate(
T item) → Treap< T> -
Adds or updates an
itemin this treap.override -
copy(
) → Treap< T> -
Returns a copy of this treap.
override
-
difference(
Treap< T> other) → Treap<T> -
Returns the difference of this treap minus
other.override -
find(
T item) → T? -
Finds the item in this treap equal to
item.inherited -
has(
T item) → bool -
Whether this treap contains an item equal to
item.inherited -
intersection(
Treap< T> other) → Treap<T> -
Returns the intersection of this treap and
other.override -
next(
T item) → T -
Returns the item succeeding
itemin the sorted sequence.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prev(
T item) → T -
Returns the item preceding
itemin the sorted sequence.inherited -
rank(
T item) → int -
Returns the rank of
itemin the sorted sequence of items.inherited -
remove(
T item) → Treap< T> -
Removes an
itemfrom this treap.override -
select(
int index) → T -
Returns the item at the given
indexin the sorted sequence.inherited -
skip(
int count) → Treap< T> -
Returns a new treap skipping the first
countitems.override -
take(
int count) → Treap< T> -
Returns a new treap containing the first
countitems.override -
toString(
) → String -
A string representation of this object.
inherited
-
union(
Treap< T> other) → Treap<T> -
Returns the union of this treap and
other.override
Operators
-
operator &(
TreapBase< T, ImmutableNode< other) → TreapBase<T> >T, ImmutableNode< T> > -
Operator overload for the intersection of two treaps.
inherited
-
operator +(
T item) → TreapBase< T, ImmutableNode< T> > -
Operator overload for adding an
itemto the treap.inherited -
operator -(
TreapBase< T, ImmutableNode< other) → TreapBase<T> >T, ImmutableNode< T> > -
Operator overload for the difference of two treaps.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → T -
Operator overload for selecting an item in the treap by its
index.inherited -
operator |(
TreapBase< T, ImmutableNode< other) → TreapBase<T> >T, ImmutableNode< T> > -
Operator overload for the union of two treaps.
inherited