| Package | as3.collections |
| Class | public class LinkedList |
| Inheritance | LinkedList AbstractLinkedList |
| Implements | ILinkedList |
The LinkedList is a specialisation of the AbstractLinkedList, from that it inherits all functionality, that makes up the linked structure.
The class defines methods in a custom namespace (as3_collections), which enables safe framework internal access to non public methods.
Runtime of operationsSee also
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new LinkedList instance.
| LinkedList | ||
|
addItem(item:*):Boolean
Adds an item to the list, usually at the end.
| LinkedList | ||
|
addItemAtEnd(item:*):Boolean
Adds an item at the end of the list.
| LinkedList | ||
|
addItemAtStart(item:*):Boolean
Adds an item in front of the list.
| LinkedList | ||
![]() |
clear():void
Clears the list by removing the references to the first
and last item.
| AbstractLinkedList | |
|
countItems(item:*):uint
Returns the number of occurrences of an item.
| LinkedList | ||
![]() |
getFirstItem():*
Returns the first item of the linked list.
| AbstractLinkedList | |
![]() |
getIterator(cursor:uint = 0):IIterator
Returns an iterator starting at the specified position.
| AbstractLinkedList | |
![]() |
getLastItem():*
Returns the last item of the linked list.
| AbstractLinkedList | |
|
getPointer(item:*):IListPointer
Returns a pointer for the linked list.
| LinkedList | ||
|
hasItem(item:*):Boolean
Tests, if an item is contained by the list.
| LinkedList | ||
|
removeAll(item:*):uint
Removes all occurrences of a particular item from the list.
| LinkedList | ||
|
removeFirstItem():*
Removes the first item of the sequence.
| LinkedList | ||
|
removeItem(item:*):Boolean
Removes an item from the list.
| LinkedList | ||
|
removeLastItem():*
Removes the last item of the sequence.
| LinkedList | ||
![]() |
reverse():void
Reverses the linked list order.
| AbstractLinkedList | |
![]() |
sort(comparator:IComparator):void
Sorts the linked list by a given criterion.
| AbstractLinkedList | |
![]() |
toArray():Array
Returns an array of all items in the present order.
| AbstractLinkedList | |
|
toString():String
Info
| LinkedList | ||
| Method | Defined by | ||
|---|---|---|---|
![]() |
addFirstNode(node:LinkedNode):void
Adds the first node to an empty list.
| AbstractLinkedList | |
![]() |
Inserts a new node after an existing one.
| AbstractLinkedList | |
![]() |
addNodeAtEnd(node:LinkedNode):void
Inserts a new node at the end of the sequence.
| AbstractLinkedList | |
![]() |
addNodeAtStart(node:LinkedNode):void
Inserts a new node at the start of the sequence.
| AbstractLinkedList | |
![]() |
Inserts a new node before an existing one.
| AbstractLinkedList | |
|
getFirstNodeOf(item:*):LinkedNode
Retrieves the first node containing the specified item.
| LinkedList | ||
![]() |
getNodeAt(index:uint):LinkedNode
Returns the node at a specific position.
| AbstractLinkedList | |
![]() |
insertionSort(comparator:IComparator):void
Insertion sort algorithm.
| AbstractLinkedList | |
![]() |
mergeSort(comparator:IComparator):void
Merge sort algorithm.
| AbstractLinkedList | |
![]() |
unlinkFirstNode():void
Unlinks the first node of the sequence.
| AbstractLinkedList | |
![]() |
unlinkLastNode():void
Unlinks the last node of the sequence.
| AbstractLinkedList | |
![]() |
unlinkNode(node:LinkedNode):void
Unlinks a node and connects predecessor with successor.
| AbstractLinkedList | |
| LinkedList | () | constructor |
public function LinkedList()Creates a new LinkedList instance.
| addItem | () | method |
public function addItem(item:*):BooleanAdds an item to the list, usually at the end.
Parametersitem:* — The item.
|
Boolean — true, if the item has been added, else false.
|
| addItemAfterNode_internal | () | method |
as3_collections function addItemAfterNode_internal(leftNode:LinkedNode, item:*):BooleanFramework internal method to add an item after an existing node.
ParametersleftNode:LinkedNode — The existing node.
|
|
item:* — The item to be added after the item of the existing node.
|
Boolean — true, if the node has been added.
|
— If no left node is given, but the list is not empty. Developer error, should not appear.
|
| addItemAtEnd | () | method |
public function addItemAtEnd(item:*):BooleanAdds an item at the end of the list.
Parametersitem:* — The item.
|
Boolean — true, if the item has been added, which should always be.
|
| addItemAtStart | () | method |
public function addItemAtStart(item:*):BooleanAdds an item in front of the list.
Parametersitem:* — The item.
|
Boolean — true, if the item has been added, which should always be.
|
| addItemBeforeNode_internal | () | method |
as3_collections function addItemBeforeNode_internal(rightNode:LinkedNode, item:*):BooleanFramework internal method to add an item before an existing node.
ParametersrightNode:LinkedNode — The existing node.
|
|
item:* — The item to be added before the item of the existing node.
|
Boolean — true, if the node has been added.
|
— If no right node is given, but the list is not empty. Developer error, should not appear.
|
| countItems | () | method |
public function countItems(item:*):uintReturns the number of occurrences of an item.
Parametersitem:* |
uint — Number of occurrences of the given item.
|
| getFirstNodeOf | () | method |
protected function getFirstNodeOf(item:*):LinkedNodeRetrieves the first node containing the specified item.
Parametersitem:* — The item to get the node for.
|
LinkedNode —
The first node containing the item or null, if none.
|
| getPointer | () | method |
public function getPointer(item:*):IListPointerReturns a pointer for the linked list.
Parametersitem:* — The item, the pointer should point to initially (optional).
|
IListPointer —
The pointer to modify the linked list.
|
| hasItem | () | method |
public function hasItem(item:*):BooleanTests, if an item is contained by the list.
Parametersitem:* — The item to test.
|
Boolean — true, if the item is contained, else false.
|
| removeAll | () | method |
public function removeAll(item:*):uintRemoves all occurrences of a particular item from the list.
The items will be removed in the order they are stored.
Parametersitem:* — The item to remove completely.
|
uint — Number of items removed.
|
| removeFirstItem | () | method |
public function removeFirstItem():*Removes the first item of the sequence.
Returns* — The first item or undefined, if the list is empty.
|
| removeItem | () | method |
public function removeItem(item:*):BooleanRemoves an item from the list.
Parametersitem:* — The item to remove.
|
Boolean — true, if the item has been removed or false, if the given item is
not contained by the list.
|
| removeLastItem | () | method |
public function removeLastItem():*Removes the last item of the sequence.
Returns* — The last item or undefined, if the list is empty.
|
| removeNode_internal | () | method |
as3_collections function removeNode_internal(node:LinkedNode):BooleanFramework internal method to remove a node.
The method may be called with a null valued node.
Parametersnode:LinkedNode — The node to remove.
|
Boolean — true, if the node has been removed or false, if the given node is null.
|
| toString | () | method |
public function toString():StringInfo
ReturnsString |