Class: Collection
Prev
Next

Class: Collection

This is the generic collection class used by Kst to store lists of objects. It behaves mostly like an array in JavaScript. At this time indices are read-only. In addition, if a collection is read-only, mutator methods will throw exceptions. Iteration looks something like this:

                for (i = 0; i < collection.length; ++i) {
                  // do something with collection[i]
                }
                

Methods:

Properties:

void append ( Object newObj )

  • Object newObj - The new object to append to the collection.

Appends a new object to the end of the collection.

void prepend ( Object newObj )

  • Object newObj - The new object to prepend to the collection.

Prepends a new object to the start of the collection.

void remove ( number n )

  • number n - The index of the entry to remove.

Removes an entry from the collection.

void remove ( Object obj )

  • Object obj - The object to remove.

Removes an object from the collection.

void clear ( )

Clears the collection, removing all entries.

number length [Read-Only]

The number of items in the collection. Items are ordered 0..(length - 1) so it is easy to iterate.

boolean readOnly [Read-Only]

True if this is a read-only collection.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team