Methods
dequeue() → {object}
Get the front element of the queue and removes it from the queue.
- Source:
Returns:
- Type:
-
object
Front element from the queue.
enqueue(obj)
Push an object in to the queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
obj |
object
|
Any object to be pushed into the queue. |
hasNext() → {boolean}
Checks if the queue isn't empty.
- Source:
Returns:
- Type:
-
boolean
Whether or not the queue has another element. True if yes.
isEmpty() → {boolean}
Checks if the queue is empty.
- Source:
Returns:
- Type:
-
boolean
Whether or not the queue is empty. True if yes.
peek() → {object}
Get the front element of the queue without removing it from the queue.
- Source:
Returns:
- Type:
-
object
Front element from the queue.
size() → {number}
Get the number of objects in the queue.
- Source:
Returns:
- Type:
-
number
Number of elements in the queue.