list class Abstracts a double linked list of strings
Inherits
object
Description
This object class abstracts a double linked list of strings. You can insert/remove items by zero based position, at the end (tail) or at the beginning (head). The list incorporates an efficient iteration method by using the $movefirst(),$movelast(), $movenext(),$moveprev(), $current() and $eof() functions.
Functions

`$sort(<bReverse:bool>)`
Sorts items in the list alphabetically ($true) or in reverse order ($false); Default to $false.
%list=$new(list); %list->$append('Foo'); %list->$append('Bar'); %list->$append('Dummy'); %list->$append('Aria'); %list->$sort(true); %list->$moveFirst(); while(%list->$eof()) { echo %list->$current(); %list->$moveNext(); }
`<integer> $count()`
Returns the number of items in the list
`<boolean> $isEmpty()`
Returns $true if the list is empty, $false otherwise.
`$clear()`
Removes all the items from the list.This is the same as $removeall().
`$removeAll()`
Removes all the items from the list. This is the same as $clear().
`$append(<item:variant>)`
Inserts the <item> at the end (tail) of the list.
`$prepend(<item:variant>)`
Inserts the <item> at the beginning (head) of the list.
`$insert(<index:uint>,<item:variant>)`
Inserts the <item> at zero-based position <index> in the list. If <index> is greater or equal to $count() then the item is simply appended to the end of the list.
`$add(<index:uint>,<item:variant>)`
This is exactly the same as $insert().
`<variant> $item(<index:uint>)`
Returns the item at zero-based <index>. If <index> is greater or equal to $count() (beyond the end of the list) then $nothing is returned.
`<boolean> $remove(<index:uint>)`
Removes the item at zero-based <index>. Returns $true if the item was successfully removed and $false otherwise (i.e. <index> pointed beyond the end of the list).
`<boolean> $removeFirst()`
Removes the first item from the list. Returns $true if the item was successfully removed (the list was not empty) and $false otherwise.
`<boolean> $removeLast()`
Removes the last item from the list. Returns $true if the item was successfully removed (the list was not empty) and $false otherwise.
`<boolean> $removeCurrent()`
Removes the current item from the list. Returns $true if the item was successfully removed or $false otherwise. Invalidates any iteration operation.
`<boolean> $moveFirst()`
Moves the iterator to the first item in the list and returns $true if the move was successful (i.e., the list is not empty) and $false otherwise.
`<boolean> $moveLast()`
Moves the iterator to the last item in the list and returns $true if the move was successful (i.e., the list is not empty) and $false otherwise.
`<boolean> $movePrev()`
Moves the iterator to the previous item and returns $true if the move was successful (i.e., there IS a previous item) and $false otherwise.
`<boolean> $moveNext()`
Moves the iterator to the next item and returns $true if the move was successful (i.e., there IS a next item) and $false otherwise.
`<boolean> $eof()`
Returns $true if the iterator points to a valid item in the list (and thus $current() would return a valid value) and $false otherwise.
`<boolean> $current()`
Returns the item pointed by the current iterator or $nothing is the iterator is not valid (points beyond the end of the list).

Index, Object Classes