@@ -53,19 +53,20 @@ extension OrderedDictionary.Elements.SubSequence {
53
53
extension OrderedDictionary . Elements . SubSequence {
54
54
/// Returns the index for the given key.
55
55
///
56
- /// If the given key is found in the dictionary, this method returns an index
57
- /// into the dictionary that corresponds with the key-value pair.
56
+ /// If the given key is found in the dictionary slice , this method returns an
57
+ /// index into the dictionary that corresponds with the key-value pair.
58
58
///
59
59
/// let countryCodes: OrderedDictionary = ["BR": "Brazil", "GH": "Ghana", "JP": "Japan"]
60
- /// let index = countryCodes.index(forKey: "JP")
60
+ /// let slice = countryCodes.elements[1...]
61
+ /// let index = slice.index(forKey: "JP")
61
62
///
62
- /// print("Country code for \(countryCodes[index!].value): '\(countryCodes[index!].key)'.")
63
+ /// print("Country code for \(countryCodes[offset: index!].value): '\(countryCodes[offset: index!].key)'.")
63
64
/// // Prints "Country code for Japan: 'JP'."
64
65
///
65
- /// - Parameter key: The key to find in the dictionary.
66
+ /// - Parameter key: The key to find in the dictionary slice .
66
67
///
67
68
/// - Returns: The index for `key` and its associated value if `key` is in
68
- /// the dictionary; otherwise, `nil`.
69
+ /// the dictionary slice ; otherwise, `nil`.
69
70
///
70
71
/// - Complexity: Expected to be O(1) on average, if `Key` implements
71
72
/// high-quality hashing.
0 commit comments