interface org.aswing.util.List
Implementors | ||||||||
ArrayList, LinkedList, 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.
@author paling
Instance Fields
function append(element:Dynamic, ?index:Int): 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.
element | element to be inserted. |
index | (optional)at which the specified element is to be inserted. |
function appendAll(arr:Array<Dynamic>, ?index:Int): 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.
arr | arr of elements to be inserted. |
index | (optional)at which the elements is to be inserted. |
function appendList(list:List, ?index:Int): 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.
arr | arr of elements to be inserted. |
index | (optional)at which the elements is to be inserted. |
function contains(element:Dynamic): Bool
Returns true if this list contains the specified element.
element | element whose presence in this list is to be tested. |
returns | true if this list contains the specified element. |
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. |
function get(index:Int): Dynamic
Returns the element at the specified position in this list.
index | 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()). |
function indexOf(element:Dynamic): 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.
element | element to search for. |
returns | the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element |
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. |
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. |
function remove(element:Dynamic): Dynamic
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.
element | element to be removed from this list, if present. |
returns | the element removed or undefined there is not such element in the list. |
function removeAt(index:Int): Dynamic
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.
index | the index of the element to removed. |
returns | the element previously at the specified position. |
function removeRange(fromIndex:Int, toIndex:Int): Array<Dynamic>
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.
fromIndex | the beginning index to be removed(include). |
fromIndex | the ending index to be removed(include). |
returns | the elements were removed. |
function replaceAt(index:Int, element:Dynamic): Dynamic
Replaces the element at the specified position in this list with the specified element.
index | index of element to replace. |
element | element to be stored at the specified position. |
returns | the element previously at the specified position. |
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. |