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:

Extends

  • EventEmitter

Members

asArray :Array.<T>

Returns all of the collection's items as array. Creates a new Array on every call.
Type:
  • Array.<T>
Source:

equalityComparer :EqualityComparer.<T>

Returns the current EqualityComparer.
Type:
Source:

equalityComparer :void

Type:
  • void
Source:

isEmpty :Boolean

Returns true, iff this Collection is empty.
Type:
  • Boolean
Source:

observableClear :Observable.<CollectionEvent.<T>>

Type:
Source:

size :Number

Returns the amount of items in this Collection.
Type:
  • Number
Source:

Methods

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) → {Boolean}

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:
Returns:
Type
Boolean

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>