Class org.as2lib.data.holder.list.AbstractList

org.as2lib.core.BasicClass
   +--org.as2lib.data.holder.list.AbstractList

Description

AbstractList provides common implementations of methods needed by implementations of the List interface.

Method Index

contains(), containsAll(), getStringifier(), indexOf(), insert(), insertAll(), insertAllByIndexAndList(), insertAllByList(), insertByValue(), insertFirst(), insertLast(), isEmpty(), remove(), removeAll(), removeByValue(), removeFirst(), removeLast(), retainAll(), setAll(), setStringifier(), subList(), toString()

Method Detail

getStringifier

static public function getStringifier(Void):Stringifier

Returns the stringifier to stringify lists.

Return

the list stringifier

setStringifier

static public function setStringifier(listStringifier:Stringifier):Void

Sets the stringifier to stringify lists.

Parameters

listStringifierthe stringifier to stringify lists

insert

public function insert():Void

insertByValue

public function insertByValue(value):Void

Inserts value at the end of this list.

Parameters

valuethe value to insert

insertFirst

public function insertFirst(value):Void

Inserts value at the beginning of this list.

Parameters

valuethe value to insert

insertLast

public function insertLast(value):Void

Inserts value at the end of this list.

Parameters

valuethe value to insert

insertAll

public function insertAll():Void

insertAllByList

public function insertAllByList(list:List):Void

Inserts all values contained in list to the end of this list.

Parameters

listthe values to insert

insertAllByIndexAndList

public function insertAllByIndexAndList(index:Number, list:List):Void

Inserts all values contained in list to this list, starting at the specified index.

Elements that are at an affected index are shifted to the right by the size of the given list.

Parameters

indexthe index to start the insertion at
listthe values to insert

Throws

IndexOutOfBoundsExceptionif the given index is not in range, this is less than 0 or greater than this list's size

remove

public function remove()

removeByValue

public function removeByValue(value):Number

Removes value from this list if it exists.

Parameters

valuethe value to remove

removeFirst

public function removeFirst(Void)

Removes the value at the beginning of this list.

Return

the removed value

removeLast

public function removeLast(Void)

Removes the value at the end of this list.

Return

the removed value

removeAll

public function removeAll(list:List):Void

Removes all values contained in list.

Parameters

listthe values to remove

setAll

public function setAll(index:Number, list:List):Void

Sets all values contained in list to this list, starting from given index. They values that were originally at the given index and following indices will be overwritten.

This method only overwrites existing index-value pairs. If an affected index is equal to or greater than this list's size, which would mean that this list's size had to be expanded, an IndexOutOfBoundsException will be thrown. In such a case use the insertAll method instead, which expands this list dynamically.

Parameters

indexthe index to start at
listthe values to set

Throws

IndexOutOfBoundsExceptionif given index is less than 0 or if any affected index, that is the given index plus the index of the specific value in the given list, is equal to or greater than this list's size

retainAll

public function retainAll(list:List):Void

Retains all values the are contained in list and removes all others.

Parameters

listthe list of values to retain

contains

public function contains(value):Boolean

Checks whether value is contained in this list.

Parameters

valuethe value to check whether it is contained

Return

true if value is contained else false

containsAll

public function containsAll(list:List):Boolean

Checks whether all values of list are contained in this list.

Parameters

listthe values to check whether they are contained

Return

true if all values of list are contained else false

subList

public function subList(fromIndex:Number, toIndex:Number):List

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

If fromIndex and toIndex are equal an empty list is returned.

The returned list is backed by this list, so changes in the returned list are reflected in this list, and vice-versa.

Parameters

fromIndexthe index from which the sub-list starts (inclusive)
toIndexthe index specifying the end of the sub-list (exclusive)

Return

a view of the specified range within this list

Throws

IndexOutOfBoundsExceptionif argument fromIndex is less than 0
IndexOutOfBoundsExceptionif argument toIndex is greater than the size of this list
IndexOutOfBoundsExceptionif argument fromIndex is greater than toIndex

indexOf

public function indexOf(value):Number

Returns the index of value.

Parameters

valuethe value to return the index of

Return

the index of value

isEmpty

public function isEmpty(Void):Boolean

Returns whether this list is empty.

This list is empty if it has no values assigned to it.

Return

true if this list is empty else false

toString

public function toString():String

Returns the string representation of this list.

The string representation is obtained via the stringifier returned by the static getStringifier method.

Return

the string representation of this list

Specified By

toString() in org.as2lib.core.BasicInterface

Overrides

toString() in org.as2lib.core.BasicClass