dw.util
Class Collection
Object
dw.util.Collection
Represents a collection of objects.
Properties
empty  :  boolean  (Read Only)
Returns true if the collection is empty.
length  :  Number  (Read Only)
The length of the collection. This is similar to to a ECMA array of 'products.length'.
Constructor Summary
This class does not have a constructor, so you cannot create it directly. To get an instance of this class, use one of the subclass constructors.
Method Summary
add(values : Object...) : boolean
Adds the specified objects to the collection.
add1(object : Object) : boolean
The method adds a single object to the collection.
addAll(objs : Collection) : boolean
Adds the collection of objects to the collection.
clear() : void
Clears the collection.
contains(obj : Object) : boolean
Returns true if the collection contains the specified object.
containsAll(objs : Collection) : boolean
Returns true if the collection contains all of the objects in the specified collection.
getLength() : Number
Returns the length of the collection.
isEmpty() : boolean
Returns true if the collection is empty.
iterator() : Iterator
Returns an iterator that can be used to access the members of the collection.
remove(obj : Object) : boolean
Removes the specified object from the collection.
removeAll(objs : Collection) : boolean
Removes all of object in the specified object from the collection.
retainAll(objs : Collection) : boolean
Removes all of object in the collection that are not in the specified collection.
size() : Number
Returns the size of the collection.
toArray() : Array
Returns all elements of this collection in a newly created array.
toArray(start : Number, size : Number) : Array
Returns a subset of the elements of this collection in a newly created array.
Method Detail
add
add(values : Object...) : boolean
Adds the specified objects to the collection. The method can also be called with an ECMA array as argument. If called with a single ECMA array as argument the individual elements of that array are added to the collection. If the array object itself should be added use the method add1().
Parameters:
values - the values to add.
Returns:
true if the values were added, false otherwise.

add1
add1(object : Object) : boolean
The method adds a single object to the collection.
Parameters:
object - the object to add.
Returns:
true if the object was added, false otherwise.

addAll
addAll(objs : Collection) : boolean
Adds the collection of objects to the collection.
Parameters:
objs - the objects to add.
Returns:
true if the objects were added, false otherwise.

clear
clear() : void
Clears the collection.

contains
contains(obj : Object) : boolean
Returns true if the collection contains the specified object.
Parameters:
obj - the object to locate in this collection.
Returns:
true if the collection contains the specified object, false otherwise.

containsAll
containsAll(objs : Collection) : boolean
Returns true if the collection contains all of the objects in the specified collection.
Parameters:
objs - the collection of objects to locate in this collection.
Returns:
true if the collection contains all of the specified objects, false otherwise.

getLength
getLength() : Number
Returns the length of the collection. This is similar to to a ECMA array of 'products.length'.
Returns:
the length of the collection.

isEmpty
isEmpty() : boolean
Returns true if the collection is empty.
Returns:
true if the collection is empty, false otherwise

iterator
iterator() : Iterator
Returns an iterator that can be used to access the members of the collection.
Returns:
an iterator that can be used to access the members of the collection.

remove
remove(obj : Object) : boolean
Removes the specified object from the collection.
Parameters:
obj - the object to remove.
Returns:
true if the specified object was removed, false otherwise.

removeAll
removeAll(objs : Collection) : boolean
Removes all of object in the specified object from the collection.
Parameters:
objs - the collection of objects to remove.
Returns:
true if the all of the specified objects were removed, false otherwise.

retainAll
retainAll(objs : Collection) : boolean
Removes all of object in the collection that are not in the specified collection.
Parameters:
objs - the collection of objects to retain in the collection.
Returns:
true if the collection retains all of the specified objects, false otherwise.

size
size() : Number
Returns the size of the collection.
Returns:
the size of the collection.

toArray
toArray() : Array
Returns all elements of this collection in a newly created array. The returned array is independent of this collection and can be modified without changing the collection. The elements in the array are in the same order as they are returned when iterating over this collection.
Returns:
a newly created array.

toArray
toArray(start : Number, size : Number) : Array
Returns a subset of the elements of this collection in a newly created array. The returned array is independent of this collection and can be modified without changing the collection. The elements in the array are in the same order as they are returned when iterating over this collection.
Parameters:
start - the number of elements to iterate before adding elements to the array. Negative values are treated as 0.
size - the maximum number of elements to add to the array. Nonpositive values always result in empty array.
Returns:
a newly created array.