Skip to content

List

class List<Type> < Object

List.

Member Functions

Name Description
size Number of elements.
empty Is this empty?
clear Clear all elements.
front Get the first element.
back Get the last element.
get Get an element.
set Set an element.
pushFront Insert a new element at the start.
pushBack Insert a new element at the end.
popFront Remove the first element.
popBack Remove the last element.
insert Insert a new element.
erase Erase an element.
getNode Get a node.

Member Fibers

Name Description
walk Iterate over the elements.

Member Function Details

back

function back() -> Type

Get the last element.

clear

function clear()

Clear all elements.

empty

function empty() -> Boolean

Is this empty?

erase

function erase(i:Integer)

Erase an element.

  • i: Position.

front

function front() -> Type

Get the first element.

get

function get(i:Integer) -> Type

Get an element.

  • i: Position.

getNode

function getNode(i:Integer) -> ListNode<Type>

Get a node.

  • i: Position.

insert

function insert(i:Integer, x:Type)

Insert a new element.

  • i: Position.
  • x: Value.

Inserts the new element immediately before the current element at position i. To insert at the end of the container, use a position that is one more than the current size, or pushBack().

popBack

function popBack()

Remove the last element.

popFront

function popFront()

Remove the first element.

pushBack

function pushBack(x:Type)

Insert a new element at the end.

  • x: Value.

pushFront

function pushFront(x:Type)

Insert a new element at the start.

  • x: Value.

set

function set(i:Integer, x:Type)

Set an element.

  • i: Position.
  • x: Value.

size

function size() -> Integer

Number of elements.

Member Fiber Details

walk

fiber walk() -> Type

Iterate over the elements.

Return: a fiber object that yields each element in forward order.