LinkedList

public enum LinkedList<Element>
extension LinkedList: Collection
extension LinkedList: ExpressibleByArrayLiteral
extension LinkedList: Equatable where Element: Equatable

The LinkedList.

Cases

  • end

    Last node in list.

    Declaration

    Swift

    case end
  • Node with pointer to next node.

    Declaration

    Swift

    indirect case node(Element, next: LinkedList<Element>)

Instance Methods

  • Push a node holding the given value onto the front of the list.

    Declaration

    Swift

    public mutating func push(x: Element)
  • Declaration

    Swift

    public mutating func pop() -> Element?

    Return Value

    The element contained by the node at the front of the list, if the list is not empty. Otherwise, nil.

Collection

  • Declaration

    Swift

    public func index(after i: Int) -> Int

    Return Value

    Index after given index i.

  • Declaration

    Swift

    public var startIndex: Int { get }

    Return Value

    Start index.

  • Returns: End index.

    Declaration

    Swift

    public var endIndex: Int { get }
  • Declaration

    Swift

    public subscript(position: Int) -> Element { get }

    Return Value

    Element at the given index.

ExpressibleByArrayLiteral

  • Create a LinkedList with an array literal.

    Declaration

    Swift

    public init(arrayLiteral elements: Element...)