Queue
public struct Queue<T>
extension Queue: CustomStringConvertible
A queue data structure implementation for managing FIFO (First In First Out) type of operations.
-
Declaration
Swift
public var isEmpty: Bool { get }
Return Value
A
Bool
indicating if the queue is empty. -
Adds a new element of type
to this Queue
instance.Declaration
Swift
public mutating func enqueue(_ element: T)
Parameters
element
The object to add to the queue.
-
Removes an element from the queue.
Declaration
Swift
public mutating func dequeue() -> T?
Return Value
The queue element that was removed from the queue.
-
Declaration
Swift
public func peek() -> T?
Return Value
The next queue element in the queue. Does not remove the element from the queue.
-
Declaration
Swift
public var description: String { get }
Return Value
A
String
describing the contents of the queue.