Package | org.as3collections |
Interface | public interface ICollection extends IIterable, org.as3coreaddendum.system.ICloneable, org.as3coreaddendum.system.IEquatable |
Implementors | AbstractArrayCollection, TypedCollection, UniqueCollection |
Some collections allow duplicate elements and others do not. Some are ordered and others unordered.
This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
The methods that modify the collection are specified to throw org.as3coreaddendum.errors.UnsupportedOperationError if the collection does not support the operation. These methods are documented as "optional operation".
This documentation is partially based in the Java Collections Framework JavaDoc documentation. For further information see Java Collections Framework
See also
Property | Defined By | ||
---|---|---|---|
allEquatable : Boolean [read-only]
Indicates whether all elements in this collection implement the interface org.as3coreaddendum.system.IEquatable. | ICollection |
Method | Defined By | ||
---|---|---|---|
add(element:*):Boolean
Ensures that this collection contains the specified element (optional operation). | ICollection | ||
addAll(collection:ICollection):Boolean
Adds all of the elements in the specified collection to this collection (optional operation). | ICollection | ||
clear():void
Removes all of the elements from this collection (optional operation). | ICollection | ||
contains(o:*):Boolean
Returns true if this collection contains the specified object. | ICollection | ||
containsAll(collection:ICollection):Boolean
Returns true if this collection contains all of the elements in the specified collection. | ICollection | ||
isEmpty():Boolean
Returns true if this collection contains no elements. | ICollection | ||
Returns an iterator over a set of elements. | IIterable | ||
remove(o:*):Boolean
Removes a single instance (only one occurrence) of the specified object from this collection, if it is present (optional operation). | ICollection | ||
removeAll(collection:ICollection):Boolean
Removes all elements of this collection that are also contained in the specified collection (optional operation). | ICollection | ||
retainAll(collection:ICollection):Boolean
Retains only the elements in this collection that are contained in the specified collection (optional operation). | ICollection | ||
size():int
Returns the number of elements in this collection. | ICollection | ||
toArray():Array
Returns an array containing all of the elements in this collection. | ICollection |
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
add | () | method |
public function add(element:*):Boolean
Ensures that this collection contains the specified element (optional operation).
Collections that support this operation may place limitations on what elements may be added to this collection.
In particular, some collections will refuse to add null
elements, and others will impose restrictions on the type of elements that may be added.
Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an error (rather than returning false
).
This preserves the invariant that a collection always contains the specified element after this call returns.
Parameters
element:* — the element to be added.
|
Boolean — true if this collection changed as a result of the call. Returns false if this collection does not permit duplicates and already contains the specified element.
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the add operation is not supported by this collection.
| |
org.as3coreaddendum.errors:ClassCastError — if the class of the specified element prevents it from being added to this collection.
| |
ArgumentError — if the specified element is null and this collection does not permit null elements.
|
addAll | () | method |
public function addAll(collection:ICollection):Boolean
Adds all of the elements in the specified collection to this collection (optional operation).
Parameters
collection:ICollection — collection containing elements to be added to this collection.
|
Boolean — true if this collection changed as a result of the call.
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the addAll operation is not supported by this collection.
| |
org.as3coreaddendum.errors:ClassCastError — if the class of an element of the specified collection prevents it from being added to this collection.
| |
ArgumentError — if the specified collection contains a null element and this collection does not permit null elements, or if the specified collection is null .
|
clear | () | method |
public function clear():void
Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
org.as3coreaddendum.errors:UnsupportedOperationError — if the clear operation is not supported by this collection.
|
contains | () | method |
public function contains(o:*):Boolean
Returns true
if this collection contains the specified object.
Parameters
o:* — object whose presence in this collection is to be tested.
|
Boolean — true if this collection contains the specified object.
|
org.as3coreaddendum.errors:ClassCastError — if the type of the specified object is incompatible with this collection (optional).
| |
ArgumentError — if the specified object is null and this collection does not permit null elements (optional).
|
containsAll | () | method |
public function containsAll(collection:ICollection):Boolean
Returns true
if this collection contains all of the elements in the specified collection.
Parameters
collection:ICollection — the collection to be checked for containment in this collection.
|
Boolean — true if this collection contains all of the elements in the specified collection.
|
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in the specified collection are incompatible with this collection (optional).
| |
ArgumentError — if the specified collection contains one or more null elements and this collection does not permit null elements (optional), or if the specified collection is null .
|
isEmpty | () | method |
public function isEmpty():Boolean
Returns true
if this collection contains no elements.
Boolean — true if this collection contains no elements.
|
remove | () | method |
public function remove(o:*):Boolean
Removes a single instance (only one occurrence) of the specified object from this collection, if it is present (optional operation).
Parameters
o:* — the object to be removed from this collection, if present.
|
Boolean — true if an object was removed as a result of this call.
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the remove operation is not supported by this collection.
| |
org.as3coreaddendum.errors:ClassCastError — if the type of the specified object is incompatible with this collection (optional).
| |
ArgumentError — if the specified object is null and this collection does not permit null elements (optional).
|
See also
removeAll | () | method |
public function removeAll(collection:ICollection):Boolean
Removes all elements of this collection that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.
Parameters
collection:ICollection — the collection containing elements to be removed from this collection.
|
Boolean — true if this collection has changed as a result of the call.
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the removeAll operation is not supported by this collection.
| |
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in this collection are incompatible with the specified collection (optional).
| |
ArgumentError — if the specified collection contains a null element and this collection does not permit null elements (optional), or if the specified collection is null .
|
retainAll | () | method |
public function retainAll(collection:ICollection):Boolean
Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.
Parameters
collection:ICollection — the collection containing elements to be retained in this collection.
|
Boolean — true if this collection changed as a result of the call.
|
org.as3coreaddendum.errors:UnsupportedOperationError — if the retainAll operation is not supported by this collection.
| |
org.as3coreaddendum.errors:ClassCastError — if the types of one or more elements in this collection are incompatible with the specified collection (optional).
| |
ArgumentError — if the specified collection contains a null element and this collection does not permit null elements (optional), or if the specified collection is null .
|
size | () | method |
public function size():int
Returns the number of elements in this collection.
Returnsint — the number of elements in this collection.
|
toArray | () | method |
public function toArray():Array
Returns an array containing all of the elements in this collection.
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
ReturnsArray — a new array object containing all of the elements in this collection.
|