Package | org.as3collections |
Class | public class UniqueCollection |
Inheritance | UniqueCollection 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.
Property | Defined By | ||
---|---|---|---|
allEquatable : Boolean [read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable. | UniqueCollection |
Method | Defined By | ||
---|---|---|---|
UniqueCollection(wrapCollection:ICollection)
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 |
allEquatable | property |
allEquatable:Boolean
[read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable
.
public function get allEquatable():Boolean
UniqueCollection | () | Constructor |
public function UniqueCollection(wrapCollection:ICollection)
Constructor, creates a new UniqueCollection
object.
wrapCollection:ICollection — the target collection to wrap.
|
ArgumentError — if the wrapCollection argument is null .
|
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 .
|
Boolean — false 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 .
|
Boolean — false if the specified collection is null or empty. Otherwise returns the return of the call wrappedCollection.addAll .
|
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.
* — 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:* |
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 |
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.
|
Boolean — true if the arbitrary evaluation considers the objects equal.
|
See also
isEmpty | () | method |
public function isEmpty():Boolean
Forwards the call to wrappedCollection.isEmpty
.
Boolean — the return of the call wrappedCollection.isEmpty .
|
iterator | () | method |
public function iterator():IIterator
Forwards the call to wrappedCollection.iterator
.
IIterator — the return of the call wrappedCollection.iterator .
|
remove | () | method |
public function remove(o:*):Boolean
Forwards the call to wrappedCollection.remove
.
Parameters
o:* |
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 |
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 |
Boolean — the return of the call wrappedCollection.retainAll .
|
size | () | method |
public function size():int
Forwards the call to wrappedCollection.size
.
int — the return of the call wrappedCollection.size .
|
toArray | () | method |
public function toArray():Array
Forwards the call to wrappedCollection.toArray
.
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.
String — the string representation of this instance.
|