Collection
Constructor
constructor
constructor(classOf, values = null): Collection<classOf>
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
classOf | string | Yes | null | Referencing the type of AbstractEntity included in the Collection |
values | Array< Reference | number | AbstractEntity > | No | [] |
Properties
classOf
Type | Description |
---|---|
string | Referencing the type of AbstractEntity included in the Collection |
size
Type | Description |
---|---|
int |
values
Type | Description |
---|---|
Set<Reference> |
Read-Only
Protocols
Iterator
Returns:
Type: Array<Reference>
Methods
add
Add an element to the collection
Parameters:
Name | Type | Description |
---|---|---|
value | Reference | AbstractEntity | int | symbol | The value to add to the Collection, if your providing Reference or AbstractEntity make sure it's match with the classOf property |
Returns:
Type: this
at
Get an element from the collection by it's index
Parameters:
Name | Type | Description |
---|---|---|
index | int | null | The index of the collection you want to retrieve, null if not found (i.e. index >= size |
Returns:
Type: Reference
clear
Empty the collection
Parameters:
Name | Type | Description |
---|
Returns:
Type: this
forEach
Executes a provided function once for each collection element
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
callback | function(Reference) | Yes | - |
Returns:
Type: this
has
Indicates whether an element with the specified value exists in the collection or not.
The existence will be tested against Reference#is method.
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
value | Reference | AbstractEntity | int | symbol | Yes | - | The value to test existence in the Collection, if your providing Reference or AbstractEntity make sure it's match with the classOf property |
Returns:
Type: boolean
indexOf
Find the index at which a given element can be found in the collection, or -1 if it is not present.
The existence will be tested against Reference#is method.
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
value | Reference | AbstractEntity | int | symbol | Yes | - | The value to test existence in the Collection, if your providing Reference or AbstractEntity make sure it's match with the classOf property |
Returns:
Type: int
remove
Remove an element from the collection
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
value | Reference | AbstractEntity | int | symbol | Yes | - | The value to remove from the Collection, if your providing Reference or AbstractEntity make sure it's match with the classOf property |
Returns:
Type: this
set
Set the collection, it is equivalent to clear then add successively all elements to the collection
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
values | Iterable< Reference | AbstractEntity | int | symbol > | Yes | - | Iif your providing Reference or AbstractEntity make sure it's match with the classOf property |
Returns:
Type: this