List

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

Primitive List implementation.

  • Delete an element at the given index.

    Declaration

    Swift

    public mutating func delete(at index: Int)

    Parameters

    index

    The index to delete.

  • Delete an element in the List.

    Declaration

    Swift

    public mutating func delete(_ element: Element) -> Bool

    Parameters

    element

    The object to be deleted.

    Return Value

    Retruns true if removed, otherwise false.

  • Insert an element in the List.

    Declaration

    Swift

    public mutating func insert(_ element: Element)

    Parameters

    element

    The element to insert in the List.

  • Search for an index and returns the element.

    Declaration

    Swift

    public func search(at index: Int) -> Element?

    Parameters

    index

    The index.

    Return Value

    Returns the element of the searched index.

  • Search an element and returns the index.

    Declaration

    Swift

    public func search(_ element: Element) -> Int?

    Parameters

    element

    The element to search.

    Return Value

    Returns the index of the searched element.