A collection of objects in which each object can occur only once.
That is, for each object of the element type, the object is either considered to be in the set, or to not be in the set.
Set implementations may consider some elements indistinguishable. These elements are treated as being the same for any operation on the set.
The default Set implementation, LinkedHashSet, considers objects indistinguishable if they are equal with regard to operator Object.==.
Iterating over elements of a set may be either unordered or ordered in some way. Examples:
It is generally not allowed to modify the set (add or remove elements) while an operation on the set is being performed, for example during a call to forEach or containsAll. Nor is it allowed to modify the set while iterating either the set itself or any Iterable that is backed by the set, such as the ones returned by methods like where and map.
It is generally not allowed to modify the equality of elements (and thus not their hashcode) while they are in the set. Some specialized subtypes may be more permissive, in which case they should document this behavior.
true
if there are no elements in this collection. [...]
value
to the set. [...]
elements
to this Set. [...]
R
instances. [...]
value
is in the set.
other
.
other
. [...]
other
. [...]
object
is in the set, return it. [...]
value
from the set. Returns true if value
was
in the set. Returns false otherwise. The method has no effect
if value
value was not in the set.
elements
from this set.
test
.
elements
. [...]
test
.
other
. [...]
test
. [...]
index
th element. [...]
test
. [...]
test
. [...]
other
. [...]
f
to each element of this collection in iteration
order.
test
. [...]
f
on each element of this Iterable
in iteration order. [...]
test
. [...]
count
elements. [...]
Iterable
that skips leading elements while test
is satisfied. [...]
count
first elements of this iterable. [...]
test
. [...]
this
. [...]
test
. [...]
T
. [...]