UniqueList

Kind of class:public class
Package:org.casalib.collection
Inherits from:List
Version:04/27/08
Author:Aaron Clinger
Classpath:org.casalib.collection.UniqueList
File last modified:Wednesday, 31 December 2008, 20:18:28
An ordered or sequence collection that contains no duplicates. Similar to Java's Set but contains all the methods of List.
See also:

Summary


Constructor
  • UniqueList (collection:Array = null)
    • Creates a new UniqueList;
Instance properties
Instance properties inherited from List
Instance methods
  • addItem (item:*) : Boolean
    • Appends the specified item to the end of this list.
  • addItemAt (item:*, index:int) : Boolean
    • Inserts an item as a specified position.
  • addItems (items:IList) : Boolean
    • Modifies original list by adding all the elements from another list that aren't already present.
  • addItemsAt (items:IList, index:int = 0x7fffffff) : Boolean
    • Modifies original list by adding all the elements from another list, that aren't already present, at a specified position.
  • setItem (item:*, index:int) : *
    • Replaces an item at a specified position.
  • subList (startIndex:int = 0, endIndex:int = 16777215) : IList
    • Returns a portion of this list.
  • clone : IList
    • Returns a list that is an exact copy of the original list.

Constructor

UniqueList

public function UniqueList (
collection:Array = null)

Creates a new UniqueList;
Parameters:
collection:
An Array of items to populate the contents of this list; UniqueList will only accept the unique elements of the Array.

Instance methods

addItem

override public function addItem (
item:*) : Boolean

Appends the specified item to the end of this list.
#
Parameters:
item:
Element to be inserted.
#
Returns:
  • Returns true if the element was unique and added; otherwise false.
Overrides:

addItemAt

override public function addItemAt (
item:*, index:int) : Boolean

Inserts an item as a specified position.
#
Parameters:
item :
Element to be inserted.
#
index:
Position where the elements should be added.
#
Returns:
  • Returns true if the element was unique and added; otherwise false.
Overrides:

addItems

override public function addItems (
items:IList) : Boolean

Modifies original list by adding all the elements from another list that aren't already present.
Parameters:
items:
List of elements to add.
#
Returns:
  • Returns true if any elements of the specified list were unique and added; otherwise false.
Overrides:

addItemsAt

override public function addItemsAt (
items:IList, index:int = 0x7fffffff) : Boolean

Modifies original list by adding all the elements from another list, that aren't already present, at a specified position.
Parameters:
items:
List of elements to add.
#
index:
Position where the elements should be added.
#
Returns:
  • Returns true if any elements of the specified list were unique and added; otherwise false.
Overrides:

clone

override public function clone (
) : IList

Returns a list that is an exact copy of the original list.
#
Returns:
  • Returns a list that is an exact copy of the original list.
    #
Overrides:

setItem

override public function setItem (
item:*, index:int) : *

Replaces an item at a specified position.
#
Parameters:
item :
The item to be stored.
#
index:
The index of the item to replace.
#
Returns:
  • The element previously at the specified position.
    #
Throws:
  • Error if you try to set an item that is already contained in the list.
Overrides:

subList

override public function subList (
startIndex:int = 0, endIndex:int = 16777215) : IList

Returns a portion of this list.
#
Parameters:
startIndex:
The starting position.
#
endIndex :
The ending position.
#
Returns:
  • The specified portion of the list.
    #
Overrides: