# class List | Native list type. More...
Full name | `KJS::List`
Definition | `#include <types.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- List ()
- ~List ()
- void append (const KJSO& obj)
- void prepend (const KJSO& obj)
- void removeFirst ()
- void removeLast ()
- void remove (const KJSO &obj)
- void clear ()
- List * copy () const
- ListIterator begin () const
- ListIterator end () const
- bool isEmpty () const
- int size () const
- KJSO at (int i) const
- KJSO operator[] (int i) const

#### Public Static Methods

- static const List * empty ()

#### Public Members

- static int count

## Detailed Description

List is a native ECMAScript type. List values are only used for intermediate results of expression evaluation and cannot be stored as properties of objects.

The list is explicitly shared. Note that while copy() returns a deep copy of the list the referenced objects are still shared.

List () | ### List

Constructor.

~List () | ### ~List

Destructor.

void append (const KJSO& obj) | ### append

Append an object to the end of the list.

Parameters:

obj | Pointer to object.

void prepend (const KJSO& obj) | ### prepend

Insert an object at the beginning of the list.

Parameters:

obj | Pointer to object.

void removeFirst () | ### removeFirst

Remove the element at the beginning of the list.

void removeLast () | ### removeLast

Remove the element at the end of the list.

void remove (const KJSO &obj) | ### remove

void clear () | ### clear

Remove all elements from the list.

List * copy () | ### copy

[const]

Returns a deep copy of the list. Ownership is passed to the user who is responsible for deleting the list then.

ListIterator begin () | ### begin

[const]

Returns: A KJS::ListIterator pointing to the first element.

ListIterator end () | ### end

[const]

Returns: A KJS::ListIterator pointing to the last element.

bool isEmpty () | ### isEmpty

[const]

Returns: true if the list is empty. false otherwise.

int size () | ### size

[const]

Returns: the current size of the list.

KJSO at (int i) | ### at

[const]

Retrieve an element at an indexed position. If you want to iterate trough the whole list using KJS::ListIterator will be faster.

Parameters:

i | List index.

Returns: Return the element at position i. KJS::Undefined if the index is out of range.

KJSO operator[] (int i) | ### operator[]

[const]

Equivalent to at.

const List * empty () | ### empty

[static]

Returns a pointer to a static instance of an empty list. Useful if a function has a KJS::List parameter.

static int count | ### count

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:56 2001, using kdoc 2.0a53.