Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
HashSet<T>
cajeta.collection.HashSet — hash-based set of unique values, a thin wrapper
around HashMap<T, T> storage: add writes, contains reads, remove
deletes. It inherits HashMap’s semantics wholesale — T.hash() picks the
bucket, == decides membership within it, and both class T (identity
semantics unless hash() / operator== are overridden) and primitive T
work without boxing.
HashSet<int32> seen = heap HashSet<int32>(16);
seen.add(7);
seen.add(7); // already a member — no-op
boolean has = seen.contains(7); // true
seen.remove(7);
int64 n = seen.count(); // 0
Methods
| Signature | |
|---|---|
HashSet(int64 initialCapacity) ⚑ | Construct with the given initial bucket capacity (must be a power of 2) |
void add(T value) | Insert value into the set |
boolean contains(T value) | True iff value was previously added and not since removed |
boolean remove(T value) | Remove value; returns true iff it was present |
int64 count() | Number of unique members currently in the set |
⚑ = @EntryPoint
See also
- Tour: HashSetDemo
- Source:
runtime/src/cajeta/collection/HashSet.cajeta - HashMap — the backing storage
- ImmutableSet — the frozen counterpart