SortedDictionary
public struct SortedDictionary<Key, Value> : DictionaryProtocol where Key : Comparable, Key : Hashable
extension SortedDictionary: Collection
extension SortedDictionary: BidirectionalCollection
extension SortedDictionary: RandomAccessCollection
extension SortedDictionary: ExpressibleByDictionaryLiteral
extension SortedDictionary: Zero
extension SortedDictionary: Equatable where Value: Equatable
extension SortedDictionary: Hashable where Value: Hashable
Ordered dictionary which has sorted keys.
-
Sorted keys.
Declaration
Swift
public var keys: SortedArray<Key> -
Values contained herein, in order sorted by their associated keys.
Declaration
Swift
public var values: [Value] { get }
-
Create an empty
SortedOrderedDictionary.Declaration
Swift
public init() -
Creates an empty
SortedDictionarytype with preallocated space for at least the specified number of elements.Declaration
Swift
public init(minimumCapacity: Int) -
Creates a
SortedDictionarywith a collection of (Key,Value) pairs.Warning
You must be certain thatpresortedis sorted, otherwise undefined behavior is certain.Declaration
Swift
public init<C>(presorted: C) where C : Collection, C.Element == (Key, Value) -
Create a
SortedDictionarywith the elements of a presortedOrderedDictionary.Warning
You must be certain thatpresortedis sorted, otherwise undefined behavior is certain.Declaration
Swift
public init(presorted: OrderedDictionary<Key, Value>) -
Creats a
SortedDictionarywith the contents of anotherSortedDictionary.Declaration
Swift
public init(_ sorted: SortedDictionary)
-
Declaration
Swift
public subscript(key: Key) -> Value? { get set }Return Value
Value for the given
key, if available. Otherwise,nil.
-
Insert the given
valuefor the givenkey. Order will be maintained.Declaration
Swift
public mutating func insert(_ value: Value, key: Key) -
Insert the contents of another
SortedDictionaryvalue.Declaration
Swift
public mutating func insert(contentsOf sortedDictionary: SortedDictionary<Key, Value>) -
Append the given
valuefor the givenguaranteedMaxkey.Warning
You must be certain thatpresortedis sorted, otherwise undefined behavior is certain.Declaration
Swift
public mutating func append(_ value: Value, guaranteedMax key: Key) -
Reserves the amount of memory required to store the given
minimumCapacityof elements.Declaration
Swift
public mutating func reserveCapacity(_ minimumCapacity: Int) -
Declaration
Swift
public func value(at index: Int) -> Value?Return Value
Value at the given
index, if present. Otherwise,nil.
-
Index after the given
index.Declaration
Swift
public func index(after index: Int) -> Int -
Start index.
Declaration
Swift
public var startIndex: Int { get } -
End index.
Declaration
Swift
public var endIndex: Int { get } -
Count.
Declaration
Swift
public var count: Int { get } -
Index before the given
index.Declaration
Swift
public func index(before index: Int) -> Int -
Declaration
Swift
public subscript(index: Int) -> (Key, Value) { get }Return Value
Element at the given
index. -
Undocumented
Declaration
Swift
public func min() -> (Key, Value)? -
Undocumented
Declaration
Swift
public func max() -> (Key, Value)? -
Undocumented
Declaration
Swift
public func sorted() -> [(Key, Value)]
-
Create a
SortedDictionarywith aDictionaryLiteral.Declaration
Swift
public init(dictionaryLiteral elements: (Key, Value)...) -
Declaration
Swift
public static var zero: SortedDictionary { get }Return Value
A
SortedDictionarywith no elements.
View on GitHub
Install in Dash
SortedDictionary Structure Reference