Class org.as2lib.data.holder.list.SubList

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

Implemented Interfaces

List

Description

SubList represents a part of a wrapped list. This part is specified by a range from one index to another index. Every changes that are made to this list are actually made to the wrapped list. You can nevertheless treat this list implementation as any other; there is no difference in usage.

Method Index

new SubList()

clear(), get(), insertByIndexAndValue(), iterator(), removeByIndex(), set(), size(), toArray()

Inherited from AbstractList

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

Constructor Detail

SubList

public function SubList(list:List, fromIndex:Number, toIndex:Number)

Constructs a new SubList instance.

Parameters

listthe list this is a sub-list of
fromIndexthe start index of this sub-list (inclusive)
toIndexthe end index of this sub-list (exclusive)

Throws

IllegalArgumentExceptionif argument list is null or undefined
IndexOutOfBoundsExceptionif argument fromIndex is less than 0
IndexOutOfBoundsExceptionif argument toIndex is greater than the size of the passed-in list
IndexOutOfBoundsExceptionif argument fromIndex is greater than toIndex

Method Detail

set

public function set(index:Number, value)

Sets value to given index on this list.

Parameters

indexthe index of value
valuethe value to set to given index

Return

the value that was orignially at given index

Throws

IndexOutOfBoundsExceptionif given index is less than 0 or equal to or greater than this list's size

Specified By

set() in org.as2lib.data.holder.List

get

public function get(index:Number)

Returns the value at given index.

Parameters

indexthe index to return the value of

Return

the value that is at given index

Throws

IndexOutOfBoundsExceptionif given index is less than 0 or equal to or greater than this list's size

Specified By

get() in org.as2lib.data.holder.List

insertByIndexAndValue

public function insertByIndexAndValue(index:Number, value):Void

Inserts value at the given index.

The element that is currently at the given index is shifted by one to the right, as well as any subsequent elements.

Parameters

indexthe index at which to insert the value
valuethe value to insert

Throws

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

Specified By

insertByIndexAndValue() in org.as2lib.data.holder.List

removeByIndex

public function removeByIndex(index:Number)

Removes the value at given index from this list and returns it.

Parameters

indexthe index of the value to remove

Return

the removed value that was originally at given index

Throws

IndexOutOfBoundsExceptionif given index is less than 0 or equal to or greater than this list's size

Specified By

removeByIndex() in org.as2lib.data.holder.List

clear

public function clear(Void):Void

Removes all values from this list.

Specified By

clear() in org.as2lib.data.holder.List

size

public function size(Void):Number

Returns the number of added values.

Return

the number of added values

Specified By

size() in org.as2lib.data.holder.List

iterator

public function iterator(Void):Iterator

Returns the iterator to iterate over this list.

Return

the iterator to iterate over this list

Specified By

iterator() in org.as2lib.data.holder.List

toArray

public function toArray(Void):Array

Returns the array representation of this list.

Return

the array representation of this list

Specified By

toArray() in org.as2lib.data.holder.List