DictionaryProtocol
public protocol DictionaryProtocol : Collection
Interface for Dictionary-like structures.
-
Key type.
Declaration
Swift
associatedtype Key : Hashable -
Value type.
Declaration
Swift
associatedtype Value
-
Create an empty
DictionaryProtocolvalue.Declaration
Swift
init() -
Creates an empty
DictionaryProtocol-conforming type with preallocated space for at least the specified number of elements.Declaration
Swift
init(minimumCapacity: Int)
-
Reserves the required amount of memory to store the given
minimumCapacityof key-value pairs.Declaration
Swift
mutating func reserveCapacity(_ minimumCapacity: Int) -
init(_:Extension method_: ) -
init(_:Extension method)
-
merge(with:Extension method) Merge the contents of the given
dictionarydestructively into this one.Declaration
Swift
public mutating func merge(with dictionary: Self) -
merged(with:Extension method) Declaration
Swift
public func merged(with dictionary: Self) -> SelfReturn Value
A new
Dictionarywith the contents of the givendictionarymergedselfover those ofself.
-
ensureValue(forKey:Extension method) Ensure that an
RangeReplaceableCollection-conforming type value exists for the givenkey.Declaration
Swift
@inlinable public mutating func ensureValue(forKey key: Key) -
safelyAppend(_:Extension methodforKey: ) -
safelyAppend(contentsOf:Extension methodforKey: )
-
safelyAndUniquelyAppend(_:Extension methodforKey: )
-
ensureValue(forKey:Extension method) Ensure that an
SetAlgebra-conforming type value exists for the givenkey.Declaration
Swift
@inlinable public mutating func ensureValue(forKey key: Key) -
safelyInsert(_:Extension methodforKey: ) -
safelyFormUnion(_:Extension methodforKey: )
-
ensureValue(forKey:Extension method) Ensure there is a value for a given
key.Declaration
Swift
@inlinable public mutating func ensureValue(forKey key: Key)
-
merge(with:Extension method) Merge the contents of the given
dictionarydestructively into this one.Warning
The value of a given key of the givendictionarywill override that of this one.Declaration
Swift
public mutating func merge(with dictionary: Self) -
merged(with:Extension method) Declaration
Swift
public mutating func merged(with dictionary: Self) -> SelfReturn Value
A new
Dictionarywith the contents of the givendictionarymergedselfover those ofself.
View on GitHub
Install in Dash
DictionaryProtocol Protocol Reference