Skip to content
FutureBlitz

    Install

    Import std.collections.sorted

    SortedSet

    std.collections.sorted

    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.

    Examples

    Local words = SortedSet<String>()
    For word In ["pear", "apple", "fig", "apple"]
        words.Add(word)
    End For
    
    Expect(words.ToArray() == ["apple", "fig", "pear"])
    Expect(words.First() == "apple" && words.Ceiling("b") == "fig")

    std/collections/sorted.fb, line 569

    • Public New() constructor #

      A new, empty SortedSet.

    • Public Property Count: Int property #

      How many values it holds.

    • @PanicsAtCaller Public Method Add(value: T): Bool method #

      Adds the value, and tells whether it's new. A value that isn't equal to itself, like NaN, panics.

    • Public Method Remove(value: T): Bool method #

      Removes the value, and tells whether it was there.

    • Public Method Contains(value: T): Bool method #

      Whether it holds value.

    • Public Method Clear() method #

      Takes every value out.

    • Public Method First(): T? method #

      The smallest value, or Null when there's none.

    • Public Method Last(): T? method #

      The largest value, or Null when there's none.

    • Public Method Floor(value: T): T? method #

      The largest value that isn't above value, or Null when there's none.

    • Public Method Ceiling(value: T): T? method #

      The smallest value that isn't below value, or Null when there's none.

    • Public Method Range(low: T, high: T): T[] method #

      The values from low up to high, without high itself, in order, in a new array.

    • Public Method ToArray(): T[] method #

      The values, in order, in a new array.

    • Public Static Method DefaultValue(): SortedSet<T> static method #

      A new, empty SortedSet.

    • Public Method Clone(): SortedSet<T> method #

      A new SortedSet with the same values.

    • Operator ==(a: SortedSet<T>, b: SortedSet<T>): Bool operator #

      Two SortedSets are equal when they have the same values.

    • Public Method Iterate(): SortedSetIterator<T> method #

      The values, in order. Adding or removing one while going over them panics.

    Report an issue with this page or with FutureBlitz on GitHub.