Packageas3.collections
Classpublic class LinkedList
InheritanceLinkedList Inheritance AbstractLinkedList
ImplementsILinkedList

List made up of sequentially linked objects.

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 operations

See also

as3.collections.core.AbstractLinkedList


Public Properties
 PropertyDefined by
 InheritednumItems : uint
Returns the size of the linked list.
AbstractLinkedList
Protected Properties
 PropertyDefined by
 Inherited_first : LinkedNode
The first item of the linked list.
AbstractLinkedList
 Inherited_last : LinkedNode
The last item of the linked list.
AbstractLinkedList
 Inherited_numItems : uint = 0
The size of the sequence.
AbstractLinkedList
 Inherited_pointer : AbstractPointer
The singleton linked list pointer.
AbstractLinkedList
Public Methods
 MethodDefined 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
 Inherited
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
 Inherited
Returns the first item of the linked list.
AbstractLinkedList
 Inherited
getIterator(cursor:uint = 0):IIterator
Returns an iterator starting at the specified position.
AbstractLinkedList
 Inherited
Returns the last item of the linked list.
AbstractLinkedList
  
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
  
Removes the first item of the sequence.
LinkedList
  
removeItem(item:*):Boolean
Removes an item from the list.
LinkedList
  
Removes the last item of the sequence.
LinkedList
 Inherited
reverse():void
Reverses the linked list order.
AbstractLinkedList
 Inherited
sort(comparator:IComparator):void
Sorts the linked list by a given criterion.
AbstractLinkedList
 Inherited
toArray():Array
Returns an array of all items in the present order.
AbstractLinkedList
  
toString():String
Info
LinkedList
Protected Methods
 MethodDefined by
 Inherited
Adds the first node to an empty list.
AbstractLinkedList
 Inherited
Inserts a new node after an existing one.
AbstractLinkedList
 Inherited
Inserts a new node at the end of the sequence.
AbstractLinkedList
 Inherited
Inserts a new node at the start of the sequence.
AbstractLinkedList
 Inherited
Inserts a new node before an existing one.
AbstractLinkedList
  
Retrieves the first node containing the specified item.
LinkedList
 Inherited
getNodeAt(index:uint):LinkedNode
Returns the node at a specific position.
AbstractLinkedList
 Inherited
insertionSort(comparator:IComparator):void
Insertion sort algorithm.
AbstractLinkedList
 Inherited
mergeSort(comparator:IComparator):void
Merge sort algorithm.
AbstractLinkedList
 Inherited
Unlinks the first node of the sequence.
AbstractLinkedList
 Inherited
Unlinks the last node of the sequence.
AbstractLinkedList
 Inherited
Unlinks a node and connects predecessor with successor.
AbstractLinkedList
Constructor detail
LinkedList()constructor
public function LinkedList()

Creates a new LinkedList instance.

Method detail
addItem()method
public function addItem(item:*):Boolean

Adds an item to the list, usually at the end.

Parameters
item:* — The item.

Returns
Boolean — true, if the item has been added, else false.
addItemAfterNode_internal()method 
as3_collections function addItemAfterNode_internal(leftNode:LinkedNode, item:*):Boolean

Framework internal method to add an item after an existing node.

Parameters
leftNode:LinkedNode — The existing node.
 
item:* — The item to be added after the item of the existing node.

Returns
Boolean — true, if the node has been added.

Throws
— If no left node is given, but the list is not empty. Developer error, should not appear.
addItemAtEnd()method 
public function addItemAtEnd(item:*):Boolean

Adds an item at the end of the list.

Parameters
item:* — The item.

Returns
Boolean — true, if the item has been added, which should always be.
addItemAtStart()method 
public function addItemAtStart(item:*):Boolean

Adds an item in front of the list.

Parameters
item:* — The item.

Returns
Boolean — true, if the item has been added, which should always be.
addItemBeforeNode_internal()method 
as3_collections function addItemBeforeNode_internal(rightNode:LinkedNode, item:*):Boolean

Framework internal method to add an item before an existing node.

Parameters
rightNode:LinkedNode — The existing node.
 
item:* — The item to be added before the item of the existing node.

Returns
Boolean — true, if the node has been added.

Throws
— If no right node is given, but the list is not empty. Developer error, should not appear.
countItems()method 
public function countItems(item:*):uint

Returns the number of occurrences of an item.

Parameters
item:*

Returns
uint — Number of occurrences of the given item.
getFirstNodeOf()method 
protected function getFirstNodeOf(item:*):LinkedNode

Retrieves the first node containing the specified item.

Parameters
item:* — The item to get the node for.

Returns
LinkedNode — The first node containing the item or null, if none.
getPointer()method 
public function getPointer(item:*):IListPointer

Returns a pointer for the linked list.

Parameters
item:* — The item, the pointer should point to initially (optional).

Returns
IListPointer — The pointer to modify the linked list.
hasItem()method 
public function hasItem(item:*):Boolean

Tests, if an item is contained by the list.

Parameters
item:* — The item to test.

Returns
Boolean — true, if the item is contained, else false.
removeAll()method 
public function removeAll(item:*):uint

Removes all occurrences of a particular item from the list.

The items will be removed in the order they are stored.

Parameters
item:* — The item to remove completely.

Returns
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:*):Boolean

Removes an item from the list.

Parameters
item:* — The item to remove.

Returns
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):Boolean

Framework internal method to remove a node.

The method may be called with a null valued node.

Parameters
node:LinkedNode — The node to remove.

Returns
Boolean — true, if the node has been removed or false, if the given node is null.
toString()method 
public function toString():String

Info

Returns
String