Packageorg.aswing.util
Interfacepublic interface List
ImplementorsLinkedList, Vector, VectorListModel

An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.



Public Methods
 MethodDefined by
  
append(element:*, index:int = -1):void
Inserts the specified element at the specified position in this list.
List
  
appendAll(arr:Array, index:int = -1):void
Inserts all the elements in a array at the specified position in this list.
List
  
appendList(list:List, index:int = -1):void
Inserts all the elements in a list at the specified position in this list.
List
  
clear():void
Removes all of the elements from this list.
List
  
contains(element:*):Boolean
Returns true if this list contains the specified element.
List
  
first():*
Returns the first element in the list.
List
  
get(index:int):*
Returns the element at the specified position in this list.
List
  
indexOf(element:*):int
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
List
  
isEmpty():Boolean
Returns true if this list contains no elements.
List
  
last():*
Returns the last element in the list.
List
  
pop():*
Removes and return the last element in the list.
List
  
remove(element:*):*
Removes the first occurrence in this list of the specified element.
List
  
removeAt(index:int):*
Removes the element at the specified position in this list.
List
  
removeRange(fromIndex:int, toIndex:int):Array
Removes the elements at the specified index range.
List
  
replaceAt(index:int, element:*):*
Replaces the element at the specified position in this list with the specified element.
List
  
shift():*
Removes and return the first element in the list.
List
  
size():int
Returns the number of elements in this list.
List
  
toArray():Array
Returns an array containing all of the elements in this list in proper sequence.
List
Method detail
append()method
public function append(element:*, index:int = -1):void

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

If index is omited, the element will be append to the end of the list. Parameters

element:* — element to be inserted.
 
index:int (default = -1) — (optional)at which the specified element is to be inserted.
appendAll()method 
public function appendAll(arr:Array, index:int = -1):void

Inserts all the elements in a array at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

If index is omited, the elements will be append to the end of the list. Parameters

arr:Array — arr of elements to be inserted.
 
index:int (default = -1) — (optional)at which the elements is to be inserted.
appendList()method 
public function appendList(list:List, index:int = -1):void

Inserts all the elements in a list at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

If index is omited, the elements will be append to the end of the list. Parameters

list:List — arr of elements to be inserted.
 
index:int (default = -1) — (optional)at which the elements is to be inserted.
clear()method 
public function clear():void

Removes all of the elements from this list. This list will be empty after this call returns.

contains()method 
public function contains(element:*):Boolean

Returns true if this list contains the specified element.

Parameters
element:* — element whose presence in this list is to be tested.

Returns
Boolean — true if this list contains the specified element.
first()method 
public function first():*

Returns the first element in the list. Undefined will be return if there is not any elements in the list.

Returns
* — the first element in the list.
get()method 
public function get(index:int):*

Returns the element at the specified position in this list.

Parameters
index:int — index of element to return.

Returns
* — the element at the specified position in this list. Undefined will be returned if the index is out of range (index < 0 || index >= size()).
indexOf()method 
public function indexOf(element:*):int

Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index.

Parameters
element:* — element to search for.

Returns
int — the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element
isEmpty()method 
public function isEmpty():Boolean

Returns true if this list contains no elements.

Returns
Boolean — true if this list contains no elements.
last()method 
public function last():*

Returns the last element in the list. Undefined will be return if there is not any elements in the list.

Returns
* — the last element in the list.
pop()method 
public function pop():*

Removes and return the last element in the list. Undefined will be return if there is not any elements in the list.

Returns
* — the last element in the list.
remove()method 
public function remove(element:*):*

Removes the first occurrence in this list of the specified element. If this list does not contain the element, it is unchanged. More formally, removes the element with the lowest index.

Parameters
element:* — element to be removed from this list, if present.

Returns
* — the element removed or undefined there is not such element in the list.
removeAt()method 
public function removeAt(index:int):*

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Parameters
index:int — the index of the element to removed.

Returns
* — the element previously at the specified position.
removeRange()method 
public function removeRange(fromIndex:int, toIndex:int):Array

Removes the elements at the specified index range. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the elements in a Array that were removed from the list.

Parameters
fromIndex:int — the beginning index to be removed(include).
 
toIndex:int — the ending index to be removed(include).

Returns
Array — the elements were removed.
replaceAt()method 
public function replaceAt(index:int, element:*):*

Replaces the element at the specified position in this list with the specified element.

Parameters
index:int — index of element to replace.
 
element:* — element to be stored at the specified position.

Returns
* — the element previously at the specified position.
shift()method 
public function shift():*

Removes and return the first element in the list. Undefined will be return if there is not any elements in the list.

Returns
* — the first element in the list.
size()method 
public function size():int

Returns the number of elements in this list.

Returns
int — the number of elements in this list.
toArray()method 
public function toArray():Array

Returns an array containing all of the elements in this list in proper sequence.

Returns
Array — an array containing all of the elements in the list.