OxL Reference

method Map.contains

Whether the map has an entry for k.

Example:

oxl✓ checked in CI
fn main() io {
  let m = {"a": 1}
  print("{m.contains("a")} {m.contains("b")}")
}
Output
true false

True when the map has an entry for k.

Example:

oxl✓ checked in CI
fn main() io {
  let m: Map<str, i32> = {"a": 1}
  print("{m.contains("a")} {m.contains("b")}")
}
Output
true false
pub(api) fn contains(k: K) -> bool

Complexity. O(1) on average.

Since. 1.0.0-beta

Parameters

NameType
kK

Returns

bool

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/collections.oxl:825

See also