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. |
- Source:
Members
maxSize
- Source:
maxSize
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).
- Source:
Methods
_truncate() → {this}
- Source:
Returns:
- Type
- this
enqueue(item) → {this}
Parameters:
Name | Type | Description |
---|---|---|
item |
T |
- Source:
Returns:
- Type
- this