OrderedDictionary
public struct OrderedDictionary<Key, Value> : DictionaryProtocol where Key : Hashable
extension OrderedDictionary: Collection
extension OrderedDictionary: ExpressibleByDictionaryLiteral
extension OrderedDictionary: Equatable where Value: Equatable
extension OrderedDictionary: Hashable where Value: Hashable
Ordered Dictionary.
-
Ordered keys.
Declaration
Swift
public var keys: [Key]
-
Values.
Declaration
Swift
public var unordered: [Key : Value]
-
Create an empty
OrderedDictionary
Declaration
Swift
public init()
-
Creates an empty
OrderedDictionary
type with preallocated space for at least the specified number of elements.Declaration
Swift
public init(minimumCapacity: Int)
-
Declaration
Swift
public subscript(key: Key) -> Value? { get set }
Return Value
Value for the given
key
, if available. Otherwise,nil
.
-
Append
value
for givenkey
.Declaration
Swift
public mutating func append(_ value: Value, key: Key)
-
Insert
value
for givenkey
atindex
.Declaration
Swift
public mutating func insert(_ value: Value, key: Key, index: Int)
-
Append the contents of another
OrderedDictionary
structure.Declaration
Swift
public mutating func appendContents(of orderedDictionary: OrderedDictionary<Key, Value>)
-
Reserves the amount of memory required to store the given
minimumCapacity
of elements.Declaration
Swift
public mutating func reserveCapacity(_ minimumCapacity: Int)
-
Declaration
Swift
public func value(index: Int) -> Value?
Return Value
The value at the given
index
.
-
- Index after given index
i
.
Declaration
Swift
public func index(after i: Int) -> Int
- Index after given index
-
Start index.
Declaration
Swift
public var startIndex: Int { get }
-
End index.
Declaration
Swift
public var endIndex: Int { get }
-
Declaration
Swift
public subscript(index: Int) -> (Key, Value) { get }
Return Value
Element at the given
index
.
-
Create an
OrderedDictionary
with aDictionaryLiteral
.Declaration
Swift
public init(dictionaryLiteral elements: (Key, Value)...)