@Generated(value="Autogenerated by OpenJAX CodeGen Template (0.2.5)", date="2020-05-23") public interface LongCollection extends LongIterable, PrimitiveCollection
long
collection hierarchy. A
primitive collection represents a group of long
values. Some
collections allow duplicate elements and others do not. Some are ordered and
others unordered.
The architecture of the long
collection hierarchy is designed
to mimic that of the collection hierarchy in Collection
, in
order to provide a nearly identical API for ease of use and interoperability.
LongList
,
ArrayLongList
,
LongSet
,
HashLongSet
Modifier and Type | Method and Description |
---|---|
boolean |
add(long value)
Ensures that this collection contains the specified value (optional
operation).
|
boolean |
addAll(Collection<Long> c)
Appends all of the values in the specified collection to the end of this
collection, in the order that they are returned by the specified
collection's
Iterator . |
default boolean |
addAll(long... a)
Appends all of the values in the specified array to the end of this
collection, in the order that they appear in the array.
|
boolean |
addAll(LongCollection c)
Appends all of the values in the specified collection to the end of this
collection, in the order that they are returned by the specified
collection's
LongIterator . |
boolean |
contains(long value)
Returns
true if this collection contains the specified value. |
default boolean |
containsAll(Collection<Long> c)
Returns
true if this collection contains all of the values in the
specified collection. |
default boolean |
containsAll(LongCollection c)
Returns
true if this collection contains all of the values in the
specified collection. |
LongStream |
parallelStream()
Returns a possibly parallel
LongStream over the values in this
collection. |
boolean |
remove(long value)
Removes the first occurrence of the specified value from this collection,
if it is present.
|
default boolean |
removeAll(Collection<Long> c)
Removes all of this collection's values that are also contained in the
specified collection.
|
boolean |
removeAll(long... a)
Removes all of this collection's values that are also contained in the
specified vararg array.
|
boolean |
removeAll(LongCollection c)
Removes all of this collection's values that are also contained in the
specified collection.
|
default boolean |
removeIf(LongPredicate filter)
Removes all of the values of this collection that satisfy the given
predicate.
|
boolean |
retainAll(Collection<Long> c)
Retains only the values in this collection that are contained in the
specified collection.
|
boolean |
retainAll(LongCollection c)
Retains only the values in this collection that are contained in the
specified collection.
|
Spliterator.OfLong |
spliterator()
Creates a
Spliterator.OfLong over the values in this collection. |
LongStream |
stream()
Returns a sequential
LongStream over the values in this collection. |
default long[] |
toArray()
Returns an array containing all of the values in this collection in proper
sequence (from first to last value).
|
long[] |
toArray(long[] a)
Returns an array containing all of the values in this collection in proper
sequence (from first to last value).
|
Long[] |
toArray(Long[] a)
Returns an array containing all of the values in this collection in proper
sequence (from first to last value).
|
iterator
boolean add(long value)
true
if this collection changed as a result of
the call. (Returns false
if this collection does not permit
duplicates and already contains the specified value).value
- Value whose presence in this collection is to be ensured.true
if this collection changed as a result of the call.default boolean addAll(long... a)
a
- Array containing values to be added to this collection.true
if this collection changed as a result of the call.NullPointerException
- If the specified array is null.boolean addAll(LongCollection c)
LongIterator
. The behavior of this operation is
undefined if the specified collection is modified while the operation is in
progress. (This implies that the behavior of this call is undefined if the
specified collection is this collection, and this collection is nonempty).c
- Collection containing values to be added to this collection.true
if this collection changed as a result of the call.NullPointerException
- If the specified collection is null.boolean addAll(Collection<Long> c)
Iterator
. The behavior of this operation is undefined
if the specified collection is modified while the operation is in progress.c
- Collection containing values to be added to this collection.true
if this collection 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 is null, or if the
specified collection contains a null value.boolean remove(long value)
i
such that Objects.equals(o, get(i))
(if such an value exists).
Returns true
if this collection contained the specified value (or
equivalently, if this collection changed as a result of the call).value
- Value to be removed from this collection, if present.true
if this collection contained the specified value.boolean removeAll(long... a)
a
- Array containing values to be removed from this collection.true
if this collection changed as a result of the call.NullPointerException
- If the specified array is null.remove(long)
,
contains(long)
boolean removeAll(LongCollection c)
c
- Collection containing values to be removed from this collection.true
if this collection changed as a result of the call.NullPointerException
- If the specified collection is null.remove(long)
,
contains(long)
default boolean removeAll(Collection<Long> c)
c
- Collection containing values to be removed from this collection.true
if this collection changed as a result of the call.ClassCastException
- If the class of an element of the specified
collection is not an Long
.NullPointerException
- If the specified collection is null, or if the
specified collection contains a null value.remove(long)
,
contains(long)
default boolean removeIf(LongPredicate filter)
The default implementation traverses all values of the collection using its
LongIterable.iterator()
. Each matching value is removed using
IntIterator.remove()
. If the collection's iterator does not support
removal then an UnsupportedOperationException
will be thrown on the
first matching value.
filter
- A predicate which returns true
for values to be
removed.true
if any values were removed.NullPointerException
- If the specified filter is null.UnsupportedOperationException
- If values cannot be removed from
this collection. Implementations may throw this exception if a
matching value cannot be removed or if, in general, removal is
not supported.boolean retainAll(Collection<Long> c)
c
- Collection containing values to be retained in this collection.true
if this collection 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 is null, or if the
specified collection contains a null value.remove(long)
,
contains(long)
boolean retainAll(LongCollection c)
c
- Collection containing values to be retained in this collection.true
if this collection changed as a result of the call.NullPointerException
- If the specified collection is null.remove(long)
,
contains(long)
boolean contains(long value)
true
if this collection contains the specified value. More
formally, returns true
if and only if this collection contains at
least one value v
such that Objects.equals(o, e)
.value
- Value whose presence in this collection is to be testedtrue
if this collection contains the specified value.default boolean containsAll(LongCollection c)
true
if this collection contains all of the values in the
specified collection.c
- Collection to be checked for containment in this collection.true
if this collection contains all of the values in the
specified collection.NullPointerException
- If the specified collection is null.contains(long)
default boolean containsAll(Collection<Long> c)
true
if this collection contains all of the values in the
specified collection.c
- Collection to be checked for containment in this collection.true
if this collection contains all of the values in the
specified collection.ClassCastException
- If the class of an element of the specified
collection is not an Long
.NullPointerException
- If the specified collection is null, or if the
specified collection contains a null value.contains(long)
default long[] toArray()
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
long[] toArray(long[] a)
If the collection fits in the specified array with room to spare (i.e., the
array has more values than the collection), the value in the array
immediately following the end of the collection is set to 0
. (This
is useful in determining the length of the collection only if the
caller knows that the collection does not contain any 0
values).
a
- The array into which the values of the collection are to be
stored. If the array is not big enough to store the values, a new
array is allocated.NullPointerException
- If the specified array is null.Long[] toArray(Long[] a)
If the collection fits in the specified array with room to spare (i.e., the array has more values than the collection), the value in the array immediately following the end of the collection is set to null.
a
- The array into which the values of the collection are to be
stored. If the array is not big enough to store the values, a new
array is allocated.NullPointerException
- If the specified array is null.Spliterator.OfLong spliterator()
Spliterator.OfLong
over the values in this collection.Spliterator.OfLong
over the values in this collection.LongStream stream()
LongStream
over the values in this collection.LongStream
over the values in this collection.LongStream parallelStream()
LongStream
over the values in this
collection.LongStream
over the values in this
collection.Copyright © 2020 LibJ. All rights reserved.