Import std.collections.sorted
std.collections.sorted
SortedMap<K, V> and SortedSet<T>: keys in order, in a B-tree. Each node holds from Order - 1
to 2 * Order - 1 keys in order, but the root, which can hold fewer, and a node that isn't a leaf
has a child before, between, and after its keys, which hold the keys between them. Finding,
adding, and removing a key looks at about log(Count) nodes.
std/collections/sorted.fb
Types
SortedMap
class
@DebugEntries Public Class SortedMap<K: Comparable, V> Implements Iterable<(K, V)>, Cloneable, Defaultable
A Map that keeps its keys in order, smallest first, for ranges and the nearest key to another.
std/collections/sorted.fb, line 43
-
A new, empty SortedMap.
-
How many entries it holds.
-
Adds an entry, or gives an existing
keyits new value, which leaves the tree as it is. A key that isn't equal to itself, like NaN, panics. -
The
key's value, or Null when it isn't there. -
The
key's value, orfallbackwhen it isn't there. -
The key's value. A key that isn't there panics.
-
Gives the key a value, adding it when it isn't there.
-
Whether
keyhas an entry. -
Removes the
key's entry, and tells whether there was one. A key that isn't there leaves the tree as it is. -
Takes every entry out.
-
The smallest key and its value, or Null when there's none.
-
The largest key and its value, or Null when there's none.
-
The largest
keythat isn't abovekey, and its value, or Null when there's none, as for akeythat isn't equal to itself. -
The smallest
keythat isn't belowkey, and its value, or Null when there's none, as for akeythat isn't equal to itself. -
The entries from
lowup tohigh, withouthighitself, in order, in a new array. An end that isn't equal to itself finds none. -
The keys, in order.
-
The values, in their keys' order.
-
A new, empty SortedMap.
-
A new SortedMap with the same entries.
-
Each key and its value, in order, for 'For key, value In map'. Giving a key a new value while going over them is fine, but adding or removing one panics.
SortedMapIterator
struct
Public Struct SortedMapIterator<K: Comparable, V> Implements Iterator<(K, V)>
The entries in order: the node the next one is in, or Null at the end, where it's at among the node's keys, and the nodes on the way down to it.
std/collections/sorted.fb, line 458
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
SortedSet
class
@DebugElements Public Class SortedSet<T: Comparable> Implements Iterable<T>, Cloneable, Defaultable, Equatable
Values without repeats, in order, which a SortedMap holds as its keys.
std/collections/sorted.fb, line 535
-
A new, empty SortedSet.
-
How many values it holds.
-
Adds the
value, and tells whether it's new. A value that isn't equal to itself, like NaN, panics. -
Removes the
value, and tells whether it was there. -
Whether it holds
value. -
Takes every value out.
-
The smallest value, or Null when there's none.
-
The largest value, or Null when there's none.
-
The largest
valuethat isn't abovevalue, or Null when there's none. -
The smallest
valuethat isn't belowvalue, or Null when there's none. -
The values from
lowup tohigh, withouthighitself, in order, in a new array. -
The values, in order, in a new array.
-
A new, empty SortedSet.
-
A new SortedSet with the same values.
-
Two SortedSets are equal when they have the same values.
-
The values, in order. Adding or removing one while going over them panics.
SortedSetIterator
struct
Public Struct SortedSetIterator<T: Comparable> Implements Iterator<T>
The values of a SortedSet, smallest first, which For ... In goes over.
std/collections/sorted.fb, line 615
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
Extends
SortedMap
extend
Extend SortedMap<K, V> Implements Equatable
No doc comment.
std/collections/sorted.fb, line 506
-
Whether
aandbare equal.Doc from
std.core.interfaces.Equatable.Operator==.
SortedMap
extend
Extend SortedMap<K, V> Implements Printable
No doc comment.
std/collections/sorted.fb, line 521
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
SortedSet
extend
Extend SortedSet<T> Implements Printable
No doc comment.
std/collections/sorted.fb, line 627
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
Report an issue with this page or with FutureBlitz on GitHub.