Class: ConstrainedQueue

ConstrainedQueue(maxSizeopt, eqCompareropt)

new ConstrainedQueue(maxSizeopt, eqCompareropt)

Creates a new, empty ConstrainedQueue.
Parameters:
Name Type Attributes Description
maxSize Number <optional>
Optional. Defaults to Number.MAX_SAFE_INTEGER. Use this parameter to limit the maximum amount of elements this Queue can hold. When the limit is reached and items are being further enqueued, the ConstrainedQueue will dequeue and discard items to make space. This parameter must be a positive integer larger than zero.
eqComparer EqualityComparer.<T> <optional>
Optional. Defaults To EqualityComparer.default.
Author:
Source:

Members

maxSize :Number

Type:
  • Number
Source:

maxSize :void

Sets the maximum size of this ConstrainedQueue. If currently there are more items, the queue will be truncated (i.e. the excess items will be discarded). The excess items will be taken from the head of the queue (dequeued).
Type:
  • void
Source:

Methods

enqueue(item) → {this}

Parameters:
Name Type Description
item T
Source:
Returns:
Type
this