Optional elements: T[]The elements parameter is an optional array of elements of type T. If provided, it
will be used to initialize the _nodes property of the class. If not provided, the _nodes property will be
initialized as an empty array.
Private _nodesPrivate _offsetThe size function returns the number of elements in an array.
The size of the array, which is the difference between the length of the array and the offset.
The peek function returns the first element of the array _nodes if it exists, otherwise it returns null.
The peek() method returns the first element of the data structure, represented by the _nodes array at
the _offset index. If the data structure is empty (size is 0), it returns null.
The push function adds an element to the end of the queue and returns the updated queue.Adds an element at the back of the queue.
The element parameter represents the element that you want to add to the queue.
The add method is returning a Queue<T> object.
Static fromThe function "fromArray" creates a new Queue object from an array of elements.Creates a queue from an existing array.
The "elements" parameter is an array of elements of type T.
The method is returning a new instance of the Queue class, initialized with the elements from the input array.
Generated using TypeDoc
The constructor initializes an instance of a class with an optional array of elements and sets the offset to 0.