An unordered hash-table based Set implementation.
The elements of a HashSet
must have consistent equality
and hashCode implementations. This means that the equals operation
must define a stable equivalence relation on the elements (reflexive,
symmetric, transitive, and consistent over time), and that the hashCode
must consistent with equality, so that the same for objects that are
considered equal.
The set allows null
as an element.
Most simple operations on HashSet
are done in (potentially amortized)
constant time: add, contains, remove, and length, provided the hash
codes of objects are well distributed.
The iteration order of the set is not specified and depends on the hashcodes of the provided elements. However, the order is stable: multiple iterations over the same set produce the same order, as long as the set is not modified.
equals
as equality. [...]
elements
. [...]
elements
. [...]
true
if there are no elements in this collection. [...]
value
to the set. [...]
elements
to this Set. [...]
test
. [...]
R
instances. [...]
value
is in the set.
other
.
other
. [...]
index
th element. [...]
test
. [...]
test
. [...]
other
. [...]
f
to each element of this collection in iteration
order.
other
. [...]
test
. [...]
object
is in the set, return it. [...]
f
on each element of this Iterable
in iteration order. [...]
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
.
test
. [...]
count
elements. [...]
Iterable
that skips leading elements while test
is satisfied. [...]
count
first elements of this iterable. [...]
test
. [...]
other
. [...]
test
. [...]
T
. [...]