Queue

public struct Queue<Element> : CustomStringConvertible where Element : Equatable

Primitive Queue implementation.

  • Dequeue the first element.

    Declaration

    Swift

    public mutating func dequeue() -> Bool

    Return Value

    Retruns true if removed, otherwise false.

  • Remove all the elements in the Queue.

    Declaration

    Swift

    public mutating func empty()
  • Adds an element to the Queue.

    Declaration

    Swift

    public mutating func enqueue(_ element: Element)

    Parameters

    element

    The element to add.

  • Returns the Queue top element.

    Declaration

    Swift

    public func top() -> Element?

    Return Value

    Returns the Queue top element.