Packageorg.as3collections
Classpublic class UniqueCollection
InheritanceUniqueCollection Inheritance Object
Implements ICollection
Subclasses UniqueList, UniqueQueue

UniqueCollection works as a wrapper for a collection.

It does not allow duplicate elements in the collection.

It stores the wrapCollection constructor's argument internally. So every method call to this class is forwarded to the wrappedCollection object. The methods that need to be checked for duplication are previously validated before forward the call. No error is thrown by the validation of duplication. The calls that are forwarded to the wrappedCollection returns the return of the wrappedCollection call.



Public Properties
 PropertyDefined By
  allEquatable : Boolean
[read-only] Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable.
UniqueCollection
Public Methods
 MethodDefined By
  
Constructor, creates a new UniqueCollection object.
UniqueCollection
  
add(element:*):Boolean
If wrappedCollection.contains(element) returns true, then this method returns false.
UniqueCollection
  
addAll(collection:ICollection):Boolean
If the specified collection is empty returns false.
UniqueCollection
  
clear():void
Forwards the call to wrappedCollection.clear.
UniqueCollection
  
clone():*
Creates and return a new UniqueCollection object with the clone of the wrappedCollection object.
UniqueCollection
  
contains(o:*):Boolean
Forwards the call to wrappedCollection.contains.
UniqueCollection
  
containsAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.containsAll.
UniqueCollection
  
equals(other:*):Boolean
This method uses CollectionUtil.equalNotConsideringOrder method to perform equality, sending this collection and other argument.
UniqueCollection
  
isEmpty():Boolean
Forwards the call to wrappedCollection.isEmpty.
UniqueCollection
  
Forwards the call to wrappedCollection.iterator.
UniqueCollection
  
remove(o:*):Boolean
Forwards the call to wrappedCollection.remove.
UniqueCollection
  
removeAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.removeAll.
UniqueCollection
  
retainAll(collection:ICollection):Boolean
Forwards the call to wrappedCollection.retainAll.
UniqueCollection
  
size():int
Forwards the call to wrappedCollection.size.
UniqueCollection
  
toArray():Array
Forwards the call to wrappedCollection.toArray.
UniqueCollection
  
toString():String
Returns the string representation of this instance.
UniqueCollection
Property Detail
allEquatableproperty
allEquatable:Boolean  [read-only]

Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable.


Implementation
    public function get allEquatable():Boolean
Constructor Detail
UniqueCollection()Constructor
public function UniqueCollection(wrapCollection:ICollection)

Constructor, creates a new UniqueCollection object.

Parameters
wrapCollection:ICollection — the target collection to wrap.

Throws
ArgumentError — if the wrapCollection argument is null.
Method Detail
add()method
public function add(element:*):Boolean

If wrappedCollection.contains(element) returns true, then this method returns false. Otherwise, it forwards the call to wrappedCollection.add.

Parameters

element:* — the element to forward to wrappedCollection.add.

Returns
Booleanfalse if wrappedCollection.contains(element) returns true. Otherwise returns the return of the call wrappedCollection.add.
addAll()method 
public function addAll(collection:ICollection):Boolean

If the specified collection is empty returns false. Otherwise, it clones the specified collection, removes all elements that already are in the wrappedCollection and removes all duplicates. Then it forwards the call to wrappedCollection.addAll sending the cloned and filtered collection.

Parameters

collection:ICollection — the collection to forward to wrappedCollection.addAll.

Returns
Booleanfalse if the specified collection is null or empty. Otherwise returns the return of the call wrappedCollection.addAll.

Throws
ArgumentError — if the specified collection contains a null element and wrappedCollection does not permit null elements, or if the specified collection is null.
clear()method 
public function clear():void

Forwards the call to wrappedCollection.clear.

clone()method 
public function clone():*

Creates and return a new UniqueCollection object with the clone of the wrappedCollection object.

Returns
* — a new UniqueCollection object with the clone of the wrappedCollection object.
contains()method 
public function contains(o:*):Boolean

Forwards the call to wrappedCollection.contains.

Parameters

o:*

Returns
Boolean — the return of the call wrappedCollection.contains.
containsAll()method 
public function containsAll(collection:ICollection):Boolean

Forwards the call to wrappedCollection.containsAll.

Parameters

collection:ICollection

Returns
Boolean — the return of the call wrappedCollection.containsAll.
equals()method 
public function equals(other:*):Boolean

This method uses CollectionUtil.equalNotConsideringOrder method to perform equality, sending this collection and other argument.

Parameters

other:* — the object to be compared for equality.

Returns
Booleantrue if the arbitrary evaluation considers the objects equal.

See also

isEmpty()method 
public function isEmpty():Boolean

Forwards the call to wrappedCollection.isEmpty.

Returns
Boolean — the return of the call wrappedCollection.isEmpty.
iterator()method 
public function iterator():IIterator

Forwards the call to wrappedCollection.iterator.

Returns
IIterator — the return of the call wrappedCollection.iterator.
remove()method 
public function remove(o:*):Boolean

Forwards the call to wrappedCollection.remove.

Parameters

o:*

Returns
Boolean — the return of the call wrappedCollection.remove.
removeAll()method 
public function removeAll(collection:ICollection):Boolean

Forwards the call to wrappedCollection.removeAll.

Parameters

collection:ICollection

Returns
Boolean — the return of the call wrappedCollection.removeAll.
retainAll()method 
public function retainAll(collection:ICollection):Boolean

Forwards the call to wrappedCollection.retainAll.

Parameters

collection:ICollection

Returns
Boolean — the return of the call wrappedCollection.retainAll.
size()method 
public function size():int

Forwards the call to wrappedCollection.size.

Returns
int — the return of the call wrappedCollection.size.
toArray()method 
public function toArray():Array

Forwards the call to wrappedCollection.toArray.

Returns
Array — the return of the call wrappedCollection.toArray.
toString()method 
public function toString():String

Returns the string representation of this instance.

This method uses CollectionUtil.toString method.

Returns
String — the string representation of this instance.