Interface ListWriter<T>
Implemented Interfaces:
A write-only view of a list of elements. ListWriter
adds random-access methods to the basic
functionality inherited from CollectionWriter
.
- Source Code:
- View Source
Inherited Fields:
Instance Method Summary
-- indexed assignment operator --
[]:= (index :
,Int value :
)T - Replaces the element at
index
with a new value. insert (index :
,Int value :
)T - Inserts a new element at
index
, moving all elements fromindex
to the end of the list out of the way to make room for it. removeIndex (index :
):Int T - Removes the element at
index
, moving all elements fromindex + 1
to the end of the list down one index to fill in the "hole" created by the deletion. removeLast ()
Inherited Methods:
Instance Methods
Replaces the element at index
with a new value.
- Parameters:
-
-index the element to modify
-value the new value
Inserts a new element at index
, moving all elements from index
to the end of the list out of
the way to make room for it. Inserting with an index
equal to count
is equivalent to calling
add
.
- Parameters:
-
-index the location at which to insert
-value the new value
Removes the element at index
, moving all elements from index + 1
to the end of the list down
one index to fill in the "hole" created by the deletion.
- Parameters:
-
-index the index to remove
- Returns:
- the value which was removed
@default
@pre(count > 0)
method removeLast
()