# ``Swift/Dictionary``

## Topics

### Creating a Dictionary

In addition to using a dictionary literal, you can also create a dictionary using
these initializers.

- ``Swift/Dictionary/init()``
- ``Swift/Dictionary/init(minimumCapacity:)``
- ``Swift/Dictionary/init(uniqueKeysWithValues:)``
- ``Swift/Dictionary/init(_:uniquingKeysWith:)``
- ``Swift/Dictionary/init(grouping:by:)``
- ``Swift/Dictionary/init(_:)``

### Inspecting a Dictionary

- ``Swift/Dictionary/isEmpty-11b2w``
- ``Swift/Dictionary/count-1s9fd``
- ``Swift/Dictionary/capacity``

### Accessing Keys and Values

- ``Swift/Dictionary/subscript(_:)-8rfql``
- ``Swift/Dictionary/subscript(_:default:)``
- ``Swift/Dictionary/index(forKey:)``
- ``Swift/Dictionary/subscript(_:)-4bhoo``
- ``Swift/Dictionary/keys-swift.property``
- ``Swift/Dictionary/values-swift.property``
- ``Swift/Dictionary/first``
- ``Swift/Dictionary/randomElement()``
- ``Swift/Dictionary/randomElement(using:)``
- ``Swift/Dictionary/init(dictionaryLiteral:)``
- ``Swift/Dictionary/init(_:)``
- ``Swift/Dictionary/indices``

### Adding Keys and Values

- ``Swift/Dictionary/updateValue(_:forKey:)``
- ``Swift/Dictionary/merge(_:uniquingKeysWith:)-m2ub``
- ``Swift/Dictionary/merge(_:uniquingKeysWith:)-7smbb``
- ``Swift/Dictionary/merging(_:uniquingKeysWith:)-3vtfs``
- ``Swift/Dictionary/merging(_:uniquingKeysWith:)-9bik6``
- ``Swift/Dictionary/reserveCapacity(_:)``

### Removing Keys and Values

- ``Swift/Dictionary/filter(_:)``
- ``Swift/Dictionary/removeValue(forKey:)``
- ``Swift/Dictionary/remove(at:)``
- ``Swift/Dictionary/removeAll(keepingCapacity:)``

### Comparing Dictionaries

- ``Swift/Dictionary/==(_:_:)``
- ``Swift/Dictionary/!=(_:_:)``

### Iterating over Keys and Values

- ``Swift/Dictionary/forEach(_:)``
- ``Swift/Dictionary/enumerated()``
- ``Swift/Dictionary/lazy``
- ``Swift/Dictionary/makeIterator()``
- ``Swift/Dictionary/underestimatedCount-4ggro``

### Finding Elements

- ``Swift/Dictionary/contains(where:)``
- ``Swift/Dictionary/allSatisfy(_:)``
- ``Swift/Dictionary/first(where:)``
- ``Swift/Dictionary/firstIndex(where:)``
- ``Swift/Dictionary/min(by:)``
- ``Swift/Dictionary/max(by:)``
- ``Swift/Dictionary/indices``
- ``Swift/Dictionary/Element``

### Transforming a Dictionary

- ``Swift/Dictionary/mapValues(_:)``
- ``Swift/Dictionary/reduce(_:_:)``
- ``Swift/Dictionary/reduce(into:_:)``
- ``Swift/Dictionary/compactMap(_:)``
- ``Swift/Dictionary/compactMapValues(_:)``
- ``Swift/Dictionary/flatMap(_:)-i3ly``
- ``Swift/Dictionary/flatMap(_:)-6chv9``
- ``Swift/Dictionary/sorted(by:)``
- ``Swift/Dictionary/shuffled()``
- ``Swift/Dictionary/shuffled(using:)``

### Performing Collection Operations

- <doc:order-dependent-operations-on-dictionary>

### Encoding and Decoding

- ``Swift/Dictionary/encode(to:)``
- ``Swift/Dictionary/init(from:)-6e6js``

### Describing a Dictionary

- ``Swift/Dictionary/description``
- ``Swift/Dictionary/debugDescription``
- ``Swift/Dictionary/customMirror``
- ``Swift/Dictionary/hash(into:)``

### Supporting Types

- ``Swift/Dictionary/Keys-swift.struct``
- ``Swift/Dictionary/Values-swift.struct``
- ``Swift/Dictionary/Index``
- ``Swift/Dictionary/Iterator``
- ``Swift/Dictionary/Element``


### Infrequently Used Functionality

- ``Swift/Dictionary/init(dictionaryLiteral:)``
