Queue<T> Summary System.Queue<T> provides a FIFO (first in, first out) data structure. Description System.Queue<T> provides a FIFO (first in, first out) data structure. Examples Instantiation 123import System; auto queue = new System.Queue<int>(); Initialization with data 123import System; auto queue = new System.Queue<int>([ 1, 2, 3 ]); Comparison with System.Stack<T> 123456import System; auto queue = new System.Queue<int>([ 1, 2, 3 ]);auto stack = new System.Stack<int>([ 1, 2, 3 ]);Console.log(queue.pop()); // 1Console.log(stack.pop()); // 3 Methods clearClears the queue by removing all elements from the queue. isEmptyChecks if the queue is empty. lengthReturns the number of elements in the queue. peekReturns the most earliest element pushed without removing it. popReturns and removes the earliest element added to the queue. pushAdds an element to the collection. Queue (Constructor)Constructs a System.Queue<T> object. toStringReturns a string representation of the queue. Share HTML | BBCode | Direct Link