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.
- Ada
- Clojure
- C++
- C++
- C++
- C#
- D
- Dart
- Elixir
- Erlang
- Go
- Haskell
- Haskell
- JS
- JS
- JS
- Java
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- Pascal
- Perl
- Python
- Python
- Ruby
- Ruby
- Ruby
- Rust
- Scala
- Scheme
- Smalltalk
- VB
bool keyExists = m.ContainsKey(key)
if (k in m) { }
maps:is_key(K, M).
Map.member k m
Assumes m is an "actual" map,
m :: Map k v.
m :: Map k v.
(/=Nothing) (lookup k m)
_m.has(_k)
Uses an actual Map instance, rather than relying on objects and their keys
m.hasOwnProperty(k)
This is like "k in m" except it doesn't check up the prototype chain, which is often not what people want.
k in m
This will lookup a property in the object and its entire prototype chain.
(nth-value 1 (gethash k m))
gethash returns a value, and a boolean for whether or not the entry is present.
m[k] ~= nil
array_key_exists($k, $m)
m.IndexOf(k) >= 0
This works for a number of Pascal containers, including TFPGMap.
exists $m->{$k}
k in m
m.get(k)
"... If default is not given, it defaults to None"
m.contains(k)
(assoc k m)
m includesKey: k.
If m.ContainsKey(k) Then...