Class: Collection

Collection(eqCompareropt)

A generic class that holds any kind of item and provides basic set- operations. This is a base class for other collections.

Constructor

new Collection(eqCompareropt)

Creates a new, empty Collection.
Parameters:
Name Type Attributes Description
eqComparer EqualityComparer.<T> <optional>
Optional. Defaults To EqualityComparer..default.
Author:
Source:

Members

_eqComparer :EqualityComparer.<T>

Type:
Source:

_items :Array.<T>

Type:
  • Array.<T>
Source:

asArray

Source:

equalityComparer

Source:

equalityComparer

Source:

isEmpty

Source:

observableClear :Observable.<CollectionEvent.<T>>

Type:
Source:

size

Source:

Methods

(protected) _validateEqualityComparer(eqComparer) → {EqualityComparer.<T>}

Parameters:
Name Type Description
eqComparer EqualityComparer.<T> The comparer
Source:
Throws:
If the given value is not of type EqualityComparer.
Type
Error
Returns:
The same comparer that was given
Type
EqualityComparer.<T>

clear() → {this}

Discards all items in this Collection.
Source:
Returns:
Type
this

(generator) entries() → {IterableIterator.<T>}

Source:
Returns:
An IterableIterator for all items in this Collection.
Type
IterableIterator.<T>

(generator) entriesReversed() → {IterableIterator.<T>}

Source:
Returns:
An IterableIterator for all items in this collection in reversed order.
Type
IterableIterator.<T>

has(item, eqCompareropt)

Parameters:
Name Type Attributes Default Description
item T The item to check for
eqComparer EqualityComparer.<T> <optional>
null an optional EqualityComparer to use. If not provided, will use the Collection's EqualityComparer.
Source:

map(callback) → {Array.<any>}

Maps a callback to each of the items and returns an array.
Parameters:
Name Type Description
callback consumerProducer3ArgHandler.<T, Number, Array.<T>, any> that gets the value, the index, and the array of values
Source:
Returns:
The mapped items as array
Type
Array.<any>