@@ -309,7 +309,7 @@ public struct Dictionary<Key, Value> /*: INSFastEnumeration<T>*/
309309 #endif
310310 }
311311
312- public mutating func removeValueForKey ( _ key: Key ) -> Value ? {
312+ public mutating func removeValue ( forKey key: Key ) -> Value ? {
313313 makeUnique ( )
314314 #if JAVA
315315 if dictionary. containsKey ( key) {
@@ -334,6 +334,12 @@ public struct Dictionary<Key, Value> /*: INSFastEnumeration<T>*/
334334 dictionary = PlatformDictionary < Key , Value > ( )
335335 unique = true
336336 }
337+
338+ public func forEach( _ body: ( ( key: Key , value: Value ) ) throws -> Void ) rethrows {
339+ for item in self {
340+ try body ( item)
341+ }
342+ }
337343
338344 public var count : Int {
339345 #if JAVA
@@ -387,23 +393,23 @@ public struct Dictionary<Key, Value> /*: INSFastEnumeration<T>*/
387393
388394public static class DictionaryHelper {
389395 #if JAVA
390- public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
396+ public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
391397 for entry in val. entrySet ( ) {
392- var item : ( Key , Value ) = ( entry. Key, entry. Value)
398+ var item : ( key : Key , value : Value ) = ( entry. Key, entry. Value)
393399 __yield item
394400 }
395401 }
396402 #elseif CLR | ISLAND
397- public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
403+ public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
398404 for entry in val {
399- var item : ( Key , Value ) = ( entry. Key, entry. Value)
405+ var item : ( key : Key , value : Value ) = ( entry. Key, entry. Value)
400406 __yield item
401407 }
402408 }
403409 #elseif COCOA
404- public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
410+ public static func Enumerate< Key, Value> ( _ val: PlatformDictionary < Key , Value > ) -> ISequence < ( Key , Value ) > {
405411 for entry in val {
406- var item : ( Key , Value ) = ( entry, val [ entry] ? )
412+ var item : ( key : Key , value : Value ) = ( entry, val [ entry] ? )
407413 __yield item
408414 }
409415 }
0 commit comments