frost.collections

Class ImmutableArray<T:Immutable>

    └ Immutable
         └ Object

Implemented Interfaces:

An immutable version of Array.

Source Code:
View Source

Class Method Summary

from(a:Array<T>):ImmutableArray<T>
Invalidates an Array and returns its contents as an ImmutableArray.

Initializer Summary

init()
Creates an empty ImmutableArray.
init(data:ListView<T>)
Creates an ImmutableArray containing all of the elements of data.
Inherited Fields:

Instance Method Summary

-- index operator --
[](index:Int):T
Returns an item from this list.
Inherited Methods:

Initializers

init ()

Creates an empty ImmutableArray.

init (data:ListView<T>)

Creates an ImmutableArray containing all of the elements of data. If you are creating an ImmutableArray from an Array, consider using the [Array.finish] method instead.

Parameters:
data - value of type ListView<T>

Class Methods

@class
method from (a:Array<T>
):ImmutableArray<T>

Invalidates an Array and returns its contents as an ImmutableArray. This is generally preferable to creating a new instance of ImmutableArray from this array, as finish() does not copy the array's contents. Interacting in any way with an Array after calling this method on it will cause precondition violations (or, if safety checks are disabled, undefined behavior).

Parameters:
a - value of type Array<T>

Instance Methods

-- index operator --
@override
function [] (index:Int
):T

Returns an item from this list.

Parameters:
index - the (zero-based) index of the item to return
Overrides:
frost.collections.ListView.[]