Package org.graalvm.collections
Interface EconomicSet<E>
- All Superinterfaces:
Iterable<E>
,UnmodifiableEconomicSet<E>
Memory efficient set data structure.
- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Addselement
to this set if it is not already present.default void
Adds all of the elements invalues
to this set if they're not already present.default void
Adds all of the elements enumerated byiterator
to this set if they're not already present.default void
addAll
(EconomicSet<E> other) Adds all of the elements inother
to this set if they're not already present.void
clear()
Removes all of the elements from this set.static <E> EconomicSet
<E> create()
Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy.static <E> EconomicSet
<E> create
(int initialCapacity) Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy and inserts all elements of the specified collection.static <E> EconomicSet
<E> create
(Equivalence strategy) Creates a new set guaranteeing insertion order when iterating over its elements.static <E> EconomicSet
<E> create
(Equivalence strategy, int initialCapacity) Creates a new set guaranteeing insertion order when iterating over its elements and initializes with the given capacity.static <E> EconomicSet
<E> create
(Equivalence strategy, UnmodifiableEconomicSet<E> c) Creates a new set guaranteeing insertion order when iterating over its elements and inserts all elements of the specified collection.static <E> EconomicSet
<E> Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy and inserts all elements of the specified collection.void
Removeselement
from this set if it is present.default void
Removes from this set all of its elements that are contained invalues
.default void
Removes from this set all of its elements that are enumerated byiterator
.default void
removeAll
(EconomicSet<E> other) Removes from this set all of its elements that are contained inother
.default void
retainAll
(EconomicSet<E> other) Removes from this set all of its elements that are not contained inother
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.graalvm.collections.UnmodifiableEconomicSet
contains, isEmpty, size, toArray
-
Method Details
-
add
Addselement
to this set if it is not already present.- Returns:
true
if this set did not already containelement
.- Since:
- 19.0
-
remove
Removeselement
from this set if it is present. This set will not containelement
once the call returns.- Since:
- 19.0
-
clear
void clear()Removes all of the elements from this set. The set will be empty after this call returns.- Since:
- 19.0
-
addAll
Adds all of the elements inother
to this set if they're not already present.- Since:
- 19.0
-
addAll
Adds all of the elements invalues
to this set if they're not already present.- Since:
- 19.0
-
addAll
Adds all of the elements enumerated byiterator
to this set if they're not already present.- Since:
- 19.0
-
removeAll
Removes from this set all of its elements that are contained inother
.- Since:
- 19.0
-
removeAll
Removes from this set all of its elements that are contained invalues
.- Since:
- 19.0
-
removeAll
Removes from this set all of its elements that are enumerated byiterator
.- Since:
- 19.0
-
retainAll
Removes from this set all of its elements that are not contained inother
.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy and inserts all elements of the specified collection.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements with the defaultEquivalence.DEFAULT
comparison strategy and inserts all elements of the specified collection.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements and initializes with the given capacity.- Since:
- 19.0
-
create
Creates a new set guaranteeing insertion order when iterating over its elements and inserts all elements of the specified collection.- Since:
- 19.0
-