add( item : T ) : Void Adds an item to the end of the List.
clear() : Void Empties the List of all items.
filter( f : T -> Bool ) : List
Returns a List filtered with a given function f where
f(x) = true.
first() : T Returns the first item in a List.
isEmpty() : Bool Returns true if the List is empty, otherwise false is
returned.
iterator() : Iterator Returns an iterator of the items in the List.
join( sep : String ) : String Returns a string representation of all the items in the
List joined by a given delimiter string.
last() : T Returns the last item in a List.
map ( f : T -> X ) : List Returns a new List where all items have been modified
by a given function.
pop() : T Removes the first item in a List and returns it.
push( item : T ) Adds an item to the beginning of the List.
remove( v : T ) : Bool Removes the first item equal to a given value.
Returns true if an item is found; otherwise false is
returned.
toString() : String Returns a string representation of the List.
Part I: The Core Language
48
Adding and Removing Items from a List
Adding values to a List is very much a different affair to an Array.
Pages:
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130