@Generated(value="Autogenerated by OpenJAX CodeGen Template (0.2.5)", date="2020-05-23") public interface LongSet extends LongCollection
long
values that contains no duplicates. More
formally, long-sets contain no pair of values v1
and v2
such
that e1 == e2
. As implied by its name, this interface models the
mathematical set abstraction.
This interface is a replica of the Set
interface that defines
synonymous methods for a list of long
values instead of Object
references.
Modifier and Type | Method and Description |
---|---|
boolean |
add(long value)
Adds the specified value to this set if it is not already present.
|
boolean |
addAll(Collection<Long> c)
Adds all of the values in the specified collection to this set if they're
not already present.
|
boolean |
addAll(LongCollection c)
Adds all of the values in the specified collection to this set if they're
not already present.
|
void |
clear()
Removes all of the values from this set.
|
boolean |
contains(long value)
Returns
true if this set contains the specified value. |
boolean |
containsAll(Collection<Long> c)
Returns
true if this set contains all of the values of the
specified collection. |
boolean |
containsAll(LongCollection c)
Returns
true if this set contains all of the values of the
specified collection. |
boolean |
equals(Object obj)
Compares the specified object with this set for equality.
|
int |
hashCode()
Returns the hash code value for this set.
|
boolean |
isEmpty()
Returns
true if this set contains no values. |
LongIterator |
iterator()
Returns an iterator over the values in this set.
|
boolean |
remove(long value)
Removes the specified value from this set if it is present.
|
boolean |
removeAll(Collection<Long> c)
Removes from this set all of its values that are contained in the specified
collection.
|
boolean |
removeAll(LongCollection c)
Removes from this set all of its values that are contained in the specified
collection.
|
boolean |
retainAll(Collection<Long> c)
Retains only the values in this set that are contained in the specified
collection.
|
boolean |
retainAll(LongCollection c)
Retains only the values in this set that are contained in the specified
collection.
|
int |
size()
Returns the number of values in this set (its cardinality).
|
Spliterator.OfLong |
spliterator()
Creates a
Spliterator.OfLong over the elements in this set. |
addAll, parallelStream, removeAll, removeIf, stream, toArray, toArray, toArray
boolean add(long value)
value
to this set if the set
contains no value value2
such that value == value2
. If this
set already contains the value, the call leaves the set unchanged and
returns false
. In combination with the restriction on constructors,
this ensures that sets never contain duplicate values.add
in interface LongCollection
value
- Value to be added to this set.true
if this set did not already contain the specified
value.boolean addAll(Collection<Long> c)
addAll
operation effectively modifies this set so that its value is
the union of the two sets. The behavior of this operation is
undefined if the specified collection is modified while the operation is in
progress.addAll
in interface LongCollection
c
- Collection containing values to be added to this set.true
if this set changed as a result of the call.ClassCastException
- If the class of an element of the specified
collection is not Long
.NullPointerException
- If the specified collection contains one or
more null values, or if the specified collection is null.addAll(LongCollection)
,
add(long)
boolean addAll(LongCollection c)
addAll
operation effectively modifies this set so that its value is
the union of the two sets. The behavior of this operation is
undefined if the specified collection is modified while the operation is in
progress.addAll
in interface LongCollection
c
- Collection containing values to be added to this set.true
if this set changed as a result of the call.NullPointerException
- If the specified collection contains one or
more null values, or if the specified collection is null.addAll(Collection)
,
add(long)
boolean contains(long value)
true
if this set contains the specified value. More
formally, returns true
if and only if this set contains a value
v
such that Objects.equals(value, v)
.contains
in interface LongCollection
value
- Value whose presence in this set is to be tested.true
if this set contains the specified value.boolean containsAll(Collection<Long> c)
true
if this set contains all of the values of the
specified collection. If the specified collection is also a set, this
method returns true
if it is a subset of this set.containsAll
in interface LongCollection
c
- Collection to be checked for containment in this set.true
if this set contains all of the values of the
specified collection.ClassCastException
- If the class of an element of the specified
collection is not Long
.NullPointerException
- If the specified collection contains one or
more null values, or if the specified collection is null.containsAll(LongCollection)
,
contains(long)
boolean containsAll(LongCollection c)
true
if this set contains all of the values of the
specified collection. If the specified collection is also a set, this
method returns true
if it is a subset of this set.containsAll
in interface LongCollection
c
- Collection to be checked for containment in this set.true
if this set contains all of the values of the
specified collection.containsAll(Collection)
,
contains(long)
boolean remove(long value)
v
such that Objects.equals(value, v)
, if
this set contains such an value. Returns true
if this set contained
the value (or equivalently, if this set changed as a result of the call).
(This set will not contain the value once the call returns).remove
in interface LongCollection
value
- Value to be removed from this set, if present.true
if this set contained the specified value.boolean removeAll(Collection<Long> c)
removeAll
in interface LongCollection
c
- Collection containing values to be removed from this set.true
if this set changed as a result of the call.ClassCastException
- If the class of an element of the specified
collection is not Long
.NullPointerException
- If the specified collection contains a null
value, or if the specified collection is null.removeAll(LongCollection)
,
remove(long)
,
contains(long)
boolean removeAll(LongCollection c)
removeAll
in interface LongCollection
c
- Collection containing values to be removed from this set.true
if this set changed as a result of the call.NullPointerException
- If the specified collection contains a null
value, or if the specified collection is null.removeAll(Collection)
,
remove(long)
,
contains(long)
boolean retainAll(Collection<Long> c)
retainAll
in interface LongCollection
c
- Collection containing values to be retained in this set.true
if this set changed as a result of the call.ClassCastException
- If the class of an element of the specified
collection is not Long
.NullPointerException
- If the specified collection contains a null
value, or if the specified collection is null.retainAll(LongCollection)
,
remove(long)
,
contains(long)
boolean retainAll(LongCollection c)
retainAll
in interface LongCollection
c
- Collection containing values to be retained in this set.true
if this set changed as a result of the call.NullPointerException
- If the specified collection contains a null
value, or if the specified collection is null.retainAll(Collection)
,
remove(long)
,
contains(long)
void clear()
clear
in interface PrimitiveCollection
int size()
Long.MAX_VALUE
values, returns
Long.MAX_VALUE
.size
in interface PrimitiveCollection
boolean isEmpty()
true
if this set contains no values.isEmpty
in interface PrimitiveCollection
true
if this set contains no values.LongIterator iterator()
iterator
in interface LongIterable
Spliterator.OfLong spliterator()
Spliterator.OfLong
over the elements in this set.
The Spliterator.OfLong
reports Spliterator.DISTINCT
.
spliterator
in interface LongCollection
Spliterator.OfLong
over the elements in this set.Spliterator.OfLong
boolean equals(Object obj)
true
if the specified object is also a set, the two sets have the
same size, and every member of the specified set is contained in this set
(or equivalently, every member of this set is contained in the specified
set). This definition ensures that the equals method works properly across
different implementations of the set interface.equals
in interface PrimitiveCollection
equals
in class Object
obj
- Object to be compared for equality with this set.true
if the specified object is equal to this set.Object.equals(Object)
,
IntSet.equals(Object)
,
IntList.equals(Object)
int hashCode()
s1 == s2
implies that s1.hashCode() == s2.hashCode()
for
any two sets s1
and s2
, as required by the general contract
of Object.hashCode()
.hashCode
in interface PrimitiveCollection
hashCode
in class Object
Object.equals(Object)
,
equals(Object)
Copyright © 2020 LibJ. All rights reserved.