Skip to content
FutureBlitz

    Install

    Import std.collections.view

    T[]

    std.collections.view

    extend

    Extend T[]

    Views of every array: part of it, read and set in place, and the whole, to read but not change.

    std/collections/view.fb, line 27

    • @PanicsAtCaller Public Method View(start: Int, finish: Int): ArrayView<T> method #

      The elements from start up to finish, without the one at finish, as a view of them in the array. They have to be in the array.

      Examples

      Local numbers = [1, 2, 3, 4, 5]
      Local middle = numbers.View(1, 4)
      middle[0] = 20
      Expect(numbers == [1, 20, 3, 4, 5])
      Expect(middle.Count == 3 && middle.ToArray() == [20, 3, 4])
    • Public Method AsReadOnly(): ReadOnlyArray<T> method #

      The array, to read but not change.

      Examples

      Local scores = [1, 2, 3]
      Local shown = scores.AsReadOnly()
      scores.Add(4)
      Expect(shown.Count == 4 && shown[3] == 4)

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