The Queue is a "first in, first out" or "FiFO" collection of data that only allow access to values at the front of a queue and repeat in that order destructively.
Class Summary
Ds\Queue implements Ds\Collection { /* Constants */ const int MIN_CAPACITY = 8 ; /* Methods */ public void allocate( int $capacity ) public int capacity( void ) public void clear( void ) public Ds\Queue copy( void ) public bool isEmpty( void ) public mixed peek( void ) public mixed pop( void ) public void push([ mixed $...values ] ) public array toArray( void ) }
Predefined Constants
Sr.No | Functions & Description |
---|---|
1 | Ds\Queue::allocate() Function This function can allocate enough memory for the required capacity. |
2 | Ds\Queue::capacity() Function This function can return the current capacity. |
3 | Ds\Queue::clear() Function This function can remove all values from a queue. |
4 | Ds\Queue::__construct() Function This function can create a new instance. |
5 | Ds\Queue::copy() Function This function can return the shallow copy of a queue. |
6 | Ds\Queue::count() Function This unction can be used to get the count of elements present in a queue. |
7 | Ds\Queue::isEmpty() Function This function can return whether the queue is empty. |
8 | Ds\Queue::jsonSerialize() Function This function can return a representation that can be converted to JSON. |
9 | Ds\Queue::peek() Function This function can return a value at the front of a queue. |
10 | Ds\Queue::pop() Function This function can remove and return a value at the front of a queue. |
11 | Ds\Queue::push() Function This function can push the values into a queue. |
12 | Ds\Queue::toArray() Function This function can convert the queue to an array. |
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.