OxL Reference

method Set.contains

Whether x is in the set.

Example:

oxl✓ checked in CI
fn main() io {
  var s: Set<i32> = Set.new()
  s.insert(5)
  print("{s.contains(5)} {s.contains(6)}")
}
Output
true false

True when x is in the set.

Example:

oxl✓ checked in CI
fn main() io {
  var s = Set<i32>.new()
  s.insert(5)
  print("{s.contains(5)} {s.contains(6)}")
}
Output
true false
pub(api) fn contains(x: T) -> bool

Complexity. O(1) on average.

Since. 1.0.0-beta

Parameters

NameType
xT

Returns

bool

Effects

none declared (pure unless the body says otherwise)

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

See also