frost.collections

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 test function on each element in the collection, removing all elements for which the function returns false.
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:

Instance 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:
range - value of type Range<Int>
list - value of type 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:
range - value of type Range<Int?>
list - value of type 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:
test - value of type (T)=>(Bit)
Overrides:
frost.collections.CollectionWriter.filterInPlace
@override
@default
method mapInPlace (f:(T)=>(T))
Parameters:
f - value of type (T)=>(T)
@default
method sortInPlace (greater:(T, T)=>(Bit))

As sort, but performs the sort in-place rather than returning a new list.

Parameters:
greater - value of type (T, T)=>(Bit)