Interface List<T>
Implemented Interfaces:
A read/write random-access list of elements.
- See also:
-
Array
- Source Code:
- View Source
Inherited Fields:
Instance Method Summary
-- indexed assignment operator --[]:= (range :,Range<Int> list :)ListView<T> - Replaces a range of elements in this list with elements from another list.
-- indexed assignment operator --[]:= (range :,Range<Int?> list :)ListView<T> - Replaces a range of elements in this list with elements from another list.
filterInPlace (test :)(T)=>(Bit) - Calls the
testfunction on each element in the collection, removing all elements for which the function returnsfalse. mapInPlace (f :)(T)=>(T) sortInPlace (greater :)(T, T)=>(Bit) - As
sort, but performs the sort in-place rather than returning a new list.
Inherited Methods:
clear()addAll(CollectionView<T>)add(T)removeLast()removeIndex(Int):Tinsert(Int, T)[]:=(Int, T)map((T)=&>(U)):Array<U>map((T)=>(U)):Array<U>apply((T)=&>())fold((T, T)=&>(T), T):Tfold((T, T)=>(T), T):Tfold((T, T)=&>(T)):Tfold((T, T)=>(T)):Tjoin(String):Stringjoin():Stringsort((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>[](Int):TInstance Methods
-- indexed assignment operator --
@default
@pre(range.min <= range.max)
method []:=
(range :Range<Int> ,
list :ListView<T> )
Replaces a range of elements in this list with elements from another list.
For example,
def list:List<Object> := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list[0 .. 5] := ["Red", "Green", "Blue"]
Console.printLine(list)
This displays [Red, Green, Blue, 6, 7, 8, 9, 10].
- Parameters:
-
- value of typerange Range<Int>
- value of typelist ListView<T>
-- indexed assignment operator --
@default
method []:=
(range :Range<Int?> ,
list :ListView<T> )
Replaces a range of elements in this list with elements from another list.
For example,
def list:List<Object> := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list[3..] := ["Red", "Green", "Blue"]
Console.printLine(list)
This displays [1, 2, 3, Red, Green, Blue].
- Parameters:
-
- value of typerange Range<Int?>
- value of typelist ListView<T>
@override
@default
method filterInPlace
(test :(T)=>(Bit) )
Calls the test function on each element in the collection, removing all elements for which the
function returns false.
For example, the code
def collection := [1, 2, 3, 4 ,5]
collection.filterInPlace(x => x % 2 = 1)
Console.printLine(collection)
will display [1, 3, 5], as the filter function returns true only for elements with odd values.
- Parameters:
-
- value of typetest (T)=>(Bit)
@override
@default
method mapInPlace
(f :(T)=>(T) )
- Parameters:
-
- value of typef (T)=>(T)
@default
method sortInPlace
(greater :(T, T)=>(Bit) )
As sort, but performs the sort in-place rather than returning a new list.
- Parameters:
-
- value of typegreater (T, T)=>(Bit)