Skip to content
Buy me a coffee

Set

Set: object

Defined in: src/immutable/ImmutableCollections.ts:781

Unmodifiable sets: null elements and null queries rejected, value equality with any Set; iteration order is unspecified.

copyOf<E>(c): Set<E>

Returns an unmodifiable set of the elements of c; duplicates are dropped and iteration order is unspecified. Returns c itself when it already is a set made by Set.of or Set.copyOf.

E

Collection<E>

Set<E>

NullPointerException if c is null or contains a null or undefined element

of<E>(…elements): Set<E>

Returns an unmodifiable set of the arguments. Iteration order is unspecified.

E

…E[]

Set<E>

IllegalArgumentException on a duplicate element

NullPointerException if an element is null or undefined

ofLazy<E>(elementCandidates, computingFunction): Set<E>

preview. Unmodifiable set whose members are the elementCandidates for which computingFunction returns true, each status computed on first access (contains, iteration, size) and at most once. Failures behave as in List.ofLazy. Later changes to elementCandidates are not seen. contains(null) throws NullPointerException; a non-candidate is never a member.

E

Set<E>

(e) => boolean

Set<E>

NullPointerException if elementCandidates, one of them, or computingFunction is null