A LinkedHashSet is a hash-table based Set implementation.
The LinkedHashSet
also keep track of the order that elements were inserted
in, and iteration happens in first-to-last insertion order.
The elements of a LinkedHashSet
must have consistent Object.==
and Object.hashCode implementations. This means that the ==
operator
must define a stable equivalence relation on the elements (reflexive,
symmetric, transitive, and consistent over time), and that hashCode
must be the same for objects that are considered equal by ==
.
The set allows null
as an element.
Iteration of elements is done in element insertion order. An element that was added after another will occur later in the iteration. Adding an element that is already in the set does not change its position in the iteration order, but removing an element and adding it again, will make it the last element of an iteration.
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..
equals
and hashCode
. [...]
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
. [...]
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
. [...]