A Set of objects that can be ordered relative to each other.
The set is based on a self-balancing binary tree. It allows most operations in amortized logarithmic time.
Elements of the set are compared using the compare
function passed in
the constructor, both for ordering and for equality.
If the set contains only an object a
, then set.contains(b)
will return true
if and only if compare(a, b) == 0
,
and the value of a == b
is not even checked.
If the compare function is omitted, the objects are assumed to be
Comparable, and are compared using their Comparable.compareTo method.
Non-comparable objects (including null
) will not work as an element
in that case.
elements
. [...]
elements
. [...]
true
if there are no elements in this collection. [...]
value
to the set. [...]
elements
to this Set. [...]
R
instances. [...]
element
. [...]
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.
elements
. [...]
other
. [...]
test
. [...]
other
.
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
.
test
.
test
. [...]
count
elements. [...]
Iterable
that skips leading elements while test
is satisfied. [...]
count
first elements of this iterable. [...]
test
. [...]
test
. [...]
T
. [...]