History of Idiom 51 > diff from v8 to v9
Edit summary for version 9 by :
↷
Version 8
2015-08-21, 07:53:53
Version 9
2015-08-21, 08:29:08
Idiom #51 Check if map contains key
Determine whether map m contains an entry for key k
Idiom #51 Check if map contains key
Determine whether map m contains an entry for key k
Demo URL
https://play.rust-lang.org/?code=use%20std%3A%3Acollections%3A%3AHashMap%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20mut%20m%20%3D%20HashMap%3A%3Anew()%3B%0A%20%20%20%20m.insert(1%2C%20%22a%22)%3B%0A%20%20%20%20m.insert(2%2C%20%22b%22)%3B%0A%20%20%20%20%0A%20%20%20%20let%20k%20%3D%202%3B%0A%20%20%20%20%0A%20%20%20%20let%20hit%20%3D%20m.contains_key(%26k)%3B%0A%20%20%20%20%0A%20%20%20%20println!(%22%7B%3A%3F%7D%22%2C%20hit)%3B%0A%7D&version=stable