Class ImmutableArray<T: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 anImmutableArray
.
Initializer Summary
init ()- Creates an empty
ImmutableArray
. init (data :
)ListView<T> - Creates an
ImmutableArray
containing all of the elements ofdata
.
Inherited Fields:
Instance Method Summary
Inherited Methods:
map((T)=&>(U)):Array<U>
map((T)=>(U)):Array<U>
apply((T)=&>())
fold((T, T)=&>(T), T):T
fold((T, T)=>(T), T):T
fold((T, T)=&>(T)):T
fold((T, T)=>(T)):T
join(String):String
join():String
sort((T, T)=>(Bit)):ListView<T>
combinations(Int):Iterator<ListView<T>>
combine(ListView<U>, (T, U)=&>(V)):ListView<V>
combine(ListView<U>, (T, U)=>(V)):ListView<V>
combine(ListView<U>):ListView<(frost.collections.ListView.T, frost.collections.ListView.combine.U)>
filter((T)=&>(Bit)):ListView<T>
filter((T)=>(Bit)):ListView<T>
[](SteppedRange<Int?, Int>):ListView<T>
[](Range<Int?>):ListView<T>
[](Range<Int>):ListView<T>
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:
-
- value of typedata 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:
-
- value of typea Array<T>
Instance Methods
Returns an item from this list.
- Parameters:
-
-index the (zero-based) index of the item to return
- Overrides:
- frost.collections.ListView.[]