public interface LongCollection extends java.util.Collection<java.lang.Long>, LongIterable
Collection
; provides some additional methods
that use polymorphism to avoid (un)boxing.
Additionally, this class defines strengthens (again) iterator()
and defines
a slightly different semantics for toArray(Object[])
.
Collection
Modifier and Type | Method and Description |
---|---|
boolean |
add(long key) |
boolean |
addAll(LongCollection c) |
boolean |
contains(long key) |
boolean |
containsAll(LongCollection c) |
LongIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
LongIterator |
longIterator()
Deprecated.
As of
fastutil 5, replaced by iterator() . |
boolean |
rem(long key)
Note that this method should be called
remove() , but the clash
with the similarly named index-based method in the List interface
forces us to use a distinguished name. |
boolean |
removeAll(LongCollection c) |
boolean |
retainAll(LongCollection c) |
long[] |
toArray(long[] a)
Returns a primitive type array containing the items of this collection.
|
<T> T[] |
toArray(T[] a)
Returns an containing the items of this collection;
the runtime type of the returned array is that of the specified array.
|
long[] |
toLongArray()
Returns a primitive type array containing the items of this collection.
|
long[] |
toLongArray(long[] a)
Returns a primitive type array containing the items of this collection.
|
LongIterator iterator()
Note that this specification strengthens the one given in
Iterable.iterator()
, which was already
strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Collection
.
iterator
in interface java.util.Collection<java.lang.Long>
iterator
in interface java.lang.Iterable<java.lang.Long>
iterator
in interface LongIterable
@Deprecated LongIterator longIterator()
fastutil
5, replaced by iterator()
.iterator()
<T> T[] toArray(T[] a)
Warning: Note that, contrarily to Collection.toArray(Object[])
, this
methods just writes all elements of this collection: no special
value will be added after the last one.
toArray
in interface java.util.Collection<java.lang.Long>
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
boolean contains(long key)
Collection.contains(Object)
long[] toLongArray()
Collection.toArray()
long[] toLongArray(long[] a)
Note that, contrarily to Collection.toArray(Object[])
, this
methods just writes all elements of this collection: no special
value will be added after the last one.
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
long[] toArray(long[] a)
Note that, contrarily to Collection.toArray(Object[])
, this
methods just writes all elements of this collection: no special
value will be added after the last one.
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
boolean add(long key)
Collection.add(Object)
boolean rem(long key)
remove()
, but the clash
with the similarly named index-based method in the List
interface
forces us to use a distinguished name. For simplicity, the set interfaces reinstates
remove()
.Collection.remove(Object)
boolean addAll(LongCollection c)
Collection.addAll(Collection)
boolean containsAll(LongCollection c)
Collection.containsAll(Collection)
boolean removeAll(LongCollection c)
Collection.removeAll(Collection)
boolean retainAll(LongCollection c)
Collection.retainAll(Collection)