Logo

Programming-Idioms

Determine whether the map m contains an entry for the key k
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
M.Contains (K)
(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).
_, ok := m[k]
import qualified Data.Map.Strict as Map
Map.member k m
(/=Nothing) (lookup k m)
_m.has(_k)
m.hasOwnProperty(k)
k in m
import java.util.Map;
m.containsKey(k)
m.containsKey(k)
(nth-value 1 (gethash k m))
m[k] ~= nil
@import Foundation;
if (m[k]) ...
array_key_exists($k, $m)
uses fgl, classes;
m.IndexOf(k) >= 0
exists $m->{$k}
k in m
m.get(k)
m.has_key?(k)
m.key?(k)
m.include?(k)
use std::collections::HashMap;
m.contains_key(&k)
m.contains(k)
(assoc k m)
m includesKey: k.
If m.ContainsKey(k) Then...