Skip to content
FutureBlitz

    Install

    Import std.collections.array

    std.collections.array

    What every collection has, on T[], besides the built-in Add, Insert, RemoveAt, Clear, Contains, Clone, Reserve, TrimExcess, Count, and Capacity: searching, the ends, many elements at once, order, and shape. A lookup gives a T?, or a T?? where the elements can be Null, and what's wrong with its arguments panics where it's called. A function given to one that changes the array changes what's left to go over, as in a For ... In, and an element it takes away panics where the Method was called.

    std/collections/array.fb

    Types

    ArrayIterator struct

    Public Struct ArrayIterator<T> Implements Iterator<T>

    An array's elements, in order, as far as its Count when each is read.

    std/collections/array.fb, line 383

    Sorting struct

    Public Struct Sorting<T>

    An array SortBy or SortByDescending sorted, whose ThenBy and ThenByDescending sort it again where the keys so far tie, in place.

    std/collections/array.fb, line 396

    • @PanicsAtCaller Public Method ThenBy<K: Comparable>(key: Func(T): K): Sorting<T> method #

      Sorts the array again by what key gives, smallest first, where the keys so far tie.

    • @PanicsAtCaller Public Method ThenByDescending<K: Comparable>(key: Func(T): K): Sorting<T> method #

      The same, largest key first.

    Extends

    T[] extend

    Extend T[]

    No doc comment.

    std/collections/array.fb, line 11

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

      Removes the first element equal to value, and tells whether there was one.

    • @PanicsAtCaller Public Method Sort() method #

      Sorts the elements in place, smallest first. Equal elements keep their order.

    • @PanicsAtCaller Public Method Sort(before: Func(T, T): Bool) method #

      Sorts the elements in place, by what before says comes first. It's a merge sort, so equal elements keep their order.

    • Public Method Filter(keep: Func(T): Bool): T[] method #

      Each element that keep says to keep, in a new array.

    • Public Method Map<U>(change: Func(T): U): U[] method #

      What change gives for each element, in a new array.

    • Public Method Find(test: Func(T): Bool): T? method #

      The first element that test says is the one, or Null.

    • Public Method FindLast(test: Func(T): Bool): T? method #

      The last element that test says is the one, or Null.

    • Public Method FindIndex(test: Func(T): Bool): Int? method #

      Where the first element that test says is the one is, or Null.

    • Public Method IndexOf(value: T): Int? method #

      Where the first element equal to value is, or Null.

    • Public Method LastIndexOf(value: T): Int? method #

      Where the last element equal to value is, or Null.

    • Public Method BinarySearch(value: T): Int? method #

      Where an element equal to value is in an array sorted smallest first, or Null, looking at about log2(Count) of them.

    • Public Method Any(test: Func(T): Bool): Bool method #

      Whether test says yes for any element, going no further than the first.

    • Public Method All(test: Func(T): Bool): Bool method #

      Whether test says yes for every element, going no further than the first it doesn't.

    • Public Method First(): T? method #

      The first element, or Null when there's none.

    • Public Method Last(): T? method #

      The last element, or Null when there's none.

    • @PanicsAtCaller Public Method RemoveLast(): T method #

      Takes the last element off, and gives it. The array can't be empty.

    • Public Method TryRemoveLast(): T? method #

      Takes the last element off, and gives it, or Null when there's none.

    • Public Method AddAll(values: T[]) method #

      Adds each of the values at the end, in order.

    • Public Method AddAll(values: Iterable<T>) method #

      The same, from any Iterable<T>, all of which is read first.

    • @PanicsAtCaller Public Method InsertAll(index: Int, values: T[]) method #

      Puts the values in, in order, from index on, which can be from 0 to Count.

    • @PanicsAtCaller Public Method InsertAll(index: Int, values: Iterable<T>) method #

      The same, from any Iterable<T>, all of which is read first.

    • @PanicsAtCaller Public Method RemoveRange(start: Int, count: Int) method #

      Takes out count elements, from start on, which must all be in the array.

    • Public Method RemoveAll(test: Func(T): Bool): Int method #

      Takes out each element that test says to, keeping the others in order, and tells how many went. An element test adds is tested too.

    • @PanicsAtCaller Public Method Resize(count: Int, fill: T) method #

      Makes the array count elements long, taking elements off the end or adding fill.

    • Public Method Fill(value: T) method #

      Gives every element the value.

    • Public Method Reverse() method #

      Puts the elements in the opposite order, in place.

    • @PanicsAtCaller Public Method Swap(a: Int, b: Int) method #

      Gives each of the two elements the other's place.

    • @PanicsAtCaller Public Method SortBy<K: Comparable>(key: Func(T): K): Sorting<T> method #

      Sorts the elements in place by what key gives for each, smallest first. Equal keys keep their elements' order, and ThenBy on what it gives breaks their ties.

    • @PanicsAtCaller Public Method SortByDescending<K: Comparable>(key: Func(T): K): Sorting<T> method #

      The same, largest key first.

    • @PanicsAtCaller Public Method SortUnstable() method #

      Sorts the elements in place, smallest first, without making another array: a heap sort, so equal elements may change places.

    • @PanicsAtCaller Public Method SortUnstable(before: Func(T, T): Bool) method #

      Sorts the elements in place, by what before says comes first, without making another array: a heap sort, so equal elements may change places.

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

      The elements, each only the first time it comes, in a new array.

    • Public Method Join(separator: String): String method #

      The elements' text, as "{x}" shows each, with separator between each two.

    • Public Method Fold<A>(start: A, combine: Func(A, T): A): A method #

      What combine gives for each element in turn, starting from start.

    • Public Method Reduce(combine: Func(T, T): T): T? method #

      What combine gives for each element in turn, starting from the first, or Null when there's none.

    T[] extend

    Extend T[] Implements Iterable<T>

    No doc comment.

    std/collections/array.fb, line 378

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