LinkedList
STRUCT
LinkedList
Swift
1public struct LinkedList<T>: ExpressibleByArrayLiteralA doubly linked list implementation.
This implementation utilizes copy on write semantics and is optimized for forward and backwards traversal and appending items (which requires accessing last).
It is not optimized for prepending or insertion of items.
Properties
head
Swift
1public var head: NodeThe head (first) node in the list
last
Swift
1public var last: NodeThe last node in the list
Methods
init(_:)
Swift
1public init(_ headValue: T)init(array:)
Swift
1public init(array: [T])init(arrayLiteral:)
Swift
1public init(arrayLiteral segments: T...)append(_:)
Swift
1public mutating func append(_ value: T)append(_:)
Swift
1public mutating func append<S: Sequence>(_ sequence: S) where S.Element == Tappending(_:)
Swift
1public func appending(_ value: T) -> LinkedList<T>appending(_:)
Swift
1public func appending<S: Sequence>(
2 _ sequence: S
3) -> LinkedList<T> where S.Element == TmutateLast(_:)
Swift
1public mutating func mutateLast(_ mutate: (T) -> T)mutatingLast(_:)
Swift
1public func mutatingLast(_ mutate: (T) -> T) -> LinkedList<T>+(_:_:)
Swift
1public static func +<S: Sequence>(
2 lhs: LinkedList<T>,
3 rhs: S
4) -> LinkedList<T> where S.Element == T+=(_:_:)
Swift
1public static func +=<S: Sequence>(
2 lhs: inout LinkedList<T>,
3 rhs: S
4) where S.Element == T