This language bar is your friend. Select your favorite languages!
_, ok := m[k]
_, ok := m[key]
(contains? m k)
#include <map>
bool key_exists = m.contains(k);
#include <map>
bool key_exists = m.count(k) != 0;
#include <map>
bool key_exists = m.find(k) != m.end();
bool keyExists = m.ContainsKey(key)
if (k in m) { }
m.containsKey(k)
Map.has_key?(m, k)
maps:is_key(K, M).
import qualified Data.Map.Strict as Map
Map.member k m
(/=Nothing) (lookup k m)
m.hasOwnProperty(k)
k in m
_m.has(_k)
import java.util.Map;
m.containsKey(k)
import kotlin.collections.map
map.containsKey(key)
m[k] ~= nil
array_key_exists($k, $m)
uses fgl, classes;
m.IndexOf(k) >= 0
exists $m->{$k}
k in m
m.has_key?(k)
m.include?(k)
m.key?(k)
use std::collections::HashMap;
m.contains_key(&k)
def contains[K](map: Map[K, _], key: K): Boolean =
  map.contains(key)
(assoc k m)
If m.ContainsKey(k) Then...

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org

Related idioms