| | |
| | | /// dict.keys.contains("key2") -> false |
| | | /// |
| | | /// - Parameter keys: keys to be removed. |
| | | mutating func removeAll<S: Sequence>(keys: S) where S.Element == Key { |
| | | mutating func removeAll(keys: some Sequence<Key>) { |
| | | keys.forEach { removeValue(forKey: $0) } |
| | | } |
| | | |
| | |
| | | /// - lhs: dictionary. |
| | | /// - keys: array with the keys to be removed. |
| | | /// - Returns: a new dictionary with keys removed. |
| | | static func - <S: Sequence>(lhs: [Key: Value], keys: S) -> [Key: Value] where S.Element == Key { |
| | | static func - (lhs: [Key: Value], keys: some Sequence<Key>) -> [Key: Value] { |
| | | var result = lhs |
| | | result.removeAll(keys: keys) |
| | | return result |
| | |
| | | /// - Parameters: |
| | | /// - lhs: dictionary. |
| | | /// - keys: array with the keys to be removed. |
| | | static func -= <S: Sequence>(lhs: inout [Key: Value], keys: S) where S.Element == Key { |
| | | static func -= (lhs: inout [Key: Value], keys: some Sequence<Key>) { |
| | | lhs.removeAll(keys: keys) |
| | | } |
| | | } |