new Queue(eqCompareropt)
Creates a new, empty Queue.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eqComparer |
EqualityComparer.<T> |
<optional> |
Optional. Defaults To EqualityComparer |
- Source:
Extends
- Collection.<T>
Members
observableDequeue :Observable.<T>
Type:
- Observable.<T>
- Source:
observableEnqueue :Observable.<T>
Type:
- Observable.<T>
- Source:
Methods
dequeue() → {T}
- Source:
Returns:
The first item (at the beginning) of the Queue.
- Type
- T
enqueue(item) → {this}
Parameters:
Name | Type | Description |
---|---|---|
item |
T | The item to add at the end of the Queue. |
- Source:
Returns:
- Type
- this
peek() → {T}
- Source:
Returns:
The first item without removing it.
- Type
- T
peekIndex(index) → {T}
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | The index of the item to peek. |
- Source:
Throws:
-
If the given index is out of range
- Type
- Error
Returns:
The item at the index.
- Type
- T
peekLast() → {T}
- Source:
Returns:
The last item without removing it.
- Type
- T
takeOutIndex(index) → {T}
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | The index of the element to remove. The index must be in the range [0, this.size - 1]. The first element to take out has index 0 (the last element inserted has the largest index, size - 1). |
- Source:
Throws:
-
If the given index is out of range
- Type
- Error
Returns:
The dequeued item
- Type
- T
takeOutItem(item, eqCompareropt) → {T}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
item |
T | The item to take ot, must be an item currently on this queue | ||
eqComparer |
EqualityComparer.<T> |
<optional> |
null | Optional. Defaults to this queue's equality comparer. Used to find the index of the given item. |
- Source:
Throws:
-
If the item cannot be found in the queue.
- Type
- Error
Returns:
The dequeued item.
- Type
- T